Timer Functions
Functions to create timers for many purposes.
runTimer
runTimer(tmrTag:String, ?time:Float = 1.0, ?loops:Int = 1):String
Starts a timer that calls "onTimerCompleted" when it ends.
Returns the formatted Timer tag.
- tmrTag - Timer tag for the "onTimerCompleted" function.
- time (Optional) - How much time it should take per loop (in seconds).
- loops (Optional) - How many times the Timer should loop, every loop calls onTimerCompleted, set to zero to repeat indefinitely.
Examples:
- runTimer('myTimer') - Creates a timer that lasts 1 second and calls onTimerCompleted('myTimer', 1, 0) when completed.
- runTimer('myTimer', 0.5, 3) - Creates a timer that lasts a half second and repeats thrice.
cancelTimer
cancelTimer(tmrTag:String):Void
Cancels a Timer created with "runTimer".
- tmrTag - Timer's Lua name tag.
Examples:
- cancelTimer('myTimer') - Cancels the timer created with runTimer('myTimer', 5.0).