How could i know the status of the timer if its still running or not?
thanks in advance [import]uid: 79884 topic_id: 18407 reply_id: 318407[/import]
+1 [import]uid: 74537 topic_id: 18407 reply_id: 70579[/import]
Not sure if there is a built in function for that, but you can just turn a flag on and off.
local timerOn = 0
--turning the timer on
timer1 = timer.performWithDelay( blah blah )
timerOn = 1
--turning the timer off
timer.cancel(timer1)
timerOn = 0
Whenever you want check if the timer is running, check the value of the flag [import]uid: 31262 topic_id: 18407 reply_id: 70598[/import]
i do not cancel the timer in my code!
it should be canceled when its finished. [import]uid: 79884 topic_id: 18407 reply_id: 70759[/import]
It doesn’t matter, this is just an example. You can set the flag to 0 when you pause the timer as well.
To check the status of the timer just use an if statement:
if ( timerOn == 1 ) then
--code here
end
You just have to set timerOn to 1 every time you turn the timer on and to 0 every time you turn it off. [import]uid: 31262 topic_id: 18407 reply_id: 70804[/import]