Edit: I threw something into the
wiki.
Lua Code:
-- run for 5 seconds
local withinInterval = true
zo_callLater(function() withinInterval = false end, 5000)
while withinInterval do
-- something
end
Or, more asynchronous - this should call the function around 10 times
Lua Code:
-- run for 5 seconds
local withinInterval = true
zo_callLater(function() withinInterval = false end, 5400)
local function callWithinInterval()
if not withinInterval then return end
-- do something
return zo_callLater(callWithinInterval, 500)
end
-- now call it
callWithinInterval()