Omnimaga
Calculator Community => TI Calculators => Lua => Topic started by: pianoman on June 27, 2011, 09:33:58 am
-
Hi everyone!
I was trying to make a timer that counts down from 30 every second, but it just got stuck on 30.
What is wrong here?
num=30
function on.paint(gc)
gc:drawString(num,0,0,"top")
timer.start(30)
end
function on.timer()
num=num-1
platform.window:invalidate()
end
-
From Lua Wiki:
timer.start(period) : Starts the timer with the given period (in seconds)
So, timer.start(30) calls the timer every 30 seconds, not "every second".
-
Oh, that makes sense.
I thought the period was how long it ran. :P
Thanks!
-
Oh, that makes sense.
I thought the period was how long it ran. :P
Thanks!
It runs forever, but you can stop it with timer.stop() ;)