timer onComplete method

it would be useful to have an event that fires when all iterations of a timer are complete

(combined with my other request for the timer to start immediately this could be

[lua]timer.performWithDelay(1000, doSomething, 100, {onComplete=finishSomething, immediate=true})[/lua]

presumably this wouldnt break old code either, as the first 3 parameters are the same

thanks
j.

[import]uid: 6645 topic_id: 3809 reply_id: 303809[/import]

note i did actually find a fix to fire the first call immediately

[import]uid: 6645 topic_id: 3809 reply_id: 11623[/import]

I’m looking for something like an onComplete for a timer, too. Would be very nice to have such a feature.

What are the other options to implement a similar functionality with the given Lua functions? I guess i would do it like this right now:

[lua]local counter = 100

local function listener( event )
print( “Doing some stuff here” )
counter = counter - 1
end

timer.performWithDelay(1000, listener, counter)

while counter >= 0 do
print (“Waiting for timer to finish”)
end

print(“Proceeding in code”)[/lua] [import]uid: 24216 topic_id: 3809 reply_id: 19473[/import]

your concept is right but you’ve implemented it wrong… that while loop wouldnt work there

anyway listener has event.count (it’s in the documentation) so you can check that in the listener itself to determine if the timer is complete [import]uid: 6645 topic_id: 3809 reply_id: 19479[/import]