Originally Posted by Ayantir
Lua Code:
myvar = "foo" zo_callLater(function() myvar="something" end, 10 * 1000)
|
This will be called only once. If you want call function every 10 seconds, use:
Lua Code:
local function MyFunction()
--do something
end
EVENT_MANAGER:RegisterForUpdate("someUniqueIdentifier", 10000, MyFunction) --10000 milliseconds = 10 seconds
EDIT:
Originally Posted by Ayantir
Lua Code:
myvar = "foo" every10s() function every10s() myvar="something" zo_callLater(every10s(), 10 * 10000) end
|
Even if this will work, I can't recommend this solution. It will basically register for update after 10 seconds, the same way as I did in my code, then it will unregister function for update and then again register for update... To much unnecessary steps involved.
How is zo_callLater defined?
Lua Code:
local ZO_CallLaterId = 1
function zo_callLater(func, ms)
local id = ZO_CallLaterId
local name = "CallLaterFunction"..id
ZO_CallLaterId = ZO_CallLaterId + 1
EVENT_MANAGER:RegisterForUpdate(name, ms,
function()
func(id)
EVENT_MANAGER:UnregisterForUpdate(name)
end)
return id
end