You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DizzasTeR edited this page Feb 21, 2021
·
4 revisions
create
Creates a timer
Timer Timer.create(function callback, int interval, int repeat [, ...optionalParameters])
Parameters
function callback — A handler function to be called
int interval — Timer interval in miliseconds (Minimum interval allowed is 50ms)
int repeat — How many times should the timer repeat or -1 to repeat indefinitely
Returns
Instance - Timer instance/object if the timer was created successfully, nil if something went wrong.
Note: Hidden Handler Var
When a timer callback/handler is executed, a hidden thisTimer variable is passed which references the current Timer instance being executed. This can be used to neatly deal with timers which aren't stored in a variable. Check Timer.destroy page example to see how its used.