Originally Posted by Torhal
They're not.
|
They're not what? Implemented in Lua?
Yes they are. Inefficient? Creating new tables (with metatables, even) and new functions for every repeating timer seems pretty inefficient to me, when it's trivial to do "repeat X times and stop" or "cancel this repeating timer" yourself without that overhead.
Code:
local n = 5
local function Update()
-- stuff
n = n - 1
if n > 0 then C_Timer.After(5, Update) end
end
C_Timer.After(5, Update)
Code:
local stop
local function Update()
if stop then return end
-- stuff
C_Timer.After(5, Update)
end
C_Timer.After(5, Update)
-- then in some event handler or wherever:
stop = true
If you're writing an arena macro, sure, go ahead and use them to save space. If you're writing an addon, I just don't see any compelling argument in favor of using them.