Jump to content

setElementData - Every Second


Recommended Posts

  • Moderators
Would it be laggy to setElementData every second?

No it won't, element datas are really powerfull.

By the way, if you want to store the current play time of the player, I would use only one setElementData that will store the result of getTickCount().

Then when you want to know how many seconds the player is in:

local tick = getTickCount() 
local joinTick = getElementData(thePlayer, "joinTick") or 0 
local secondsIn = (tick - joinTick) / 1000 

Do as you would like.

Link to comment
Would it be laggy to setElementData every second?
No it won't, element datas are really powerfull.

Indeed. The main reason for that is that element data isn't going thru the Lua VM, but the core, so it should be considered as a more native feature. Depends on the usage though, sometimes tables are far better than element data.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...