-
Notifications
You must be signed in to change notification settings - Fork 0
Timers
A description of every timer type class.
Timers are objects that run functions at precice points in time.
The Delay Timer runs a function after a set delay. (The timer's delay is still referred to as the period.)
-
TimerDelay:new(delay, fn, t, noInstantRun)
Creates a new timer with delay<delay>, function<fn>and timescale<t>. If<noInstantRun>is true, the timer will wait for the next execution ofTimerDelay:newDelay(p)before running. -
TimerDelay:newDelay(delay)
Starts the timer with delay<delay>in seconds. This function runsTimerDelay:setPeriod(p)with<delay>before starting the timer. -
TimerDelay:stop()
Stops the currently running delay operation. -
TimerDelay:setPeriod(p)
Sets the delay in seconds. The delay (period) of this timer is allowed to be zero. -
TimerDelay:getPeriod()
Gets the delay. -
TimerDelay:setFunction(fn)
Sets the function. -
TimerDelay:getFunction()
Gets the function. -
TimerDelay:setTimescale(t)
Sets the timescale. -
TimerDelay:getTimescale()
Gets the timescale. -
TimerDelay:step(mFrameTime, ...)
Advances the timer and runs the function when necessary.
The Periodic Timer runs a function at set intervals.
-
TimerPeriodic:new(p, fn, noInstantRun, t)
Creates a new timer with period<p>, function<fn>and timescale<t>. If<noInstantRun>is true, the first execution of the function is skipped. -
TimerPeriodic:reset(noInstantRun)
Restarts the timer. If<noInstantRun>is true, the first execution of the function is skipped. -
TimerPeriodic:setPeriod(p)
Sets the period in seconds. -
TimerPeriodic:getPeriod()
Gets the period. -
TimerPeriodic:setFunction(fn)
Sets the function. -
TimerPeriodic:getFunction()
Gets the function. -
TimerPeriodic:setTimescale(t)
Sets the timescale. -
TimerPeriodic:getTimescale()
Gets the timescale. -
TimerPeriodic:step(mFrameTime, ...)
Advances the timer and runs the function when necessary.
The Rate Timer is similar to a Periodic Timer. It is used to modify the tick rate of a level. Its period set using hertz instead of seconds.
-
TimerRate:new(hz, fn)
Creates a new timer with frequency<hz>and function<fn>. -
TimerRate:setRate(hz)
Sets the frequency in hertz. Defaults to 240. The frequency must be greater than zero. -
TimerRate:getRate()
Gets the frequency. -
TimerRate:setFunction(fn)
Sets the function. -
TimerRate:getFunction()
Gets the function. -
TimerRate:step(mFrameTime, ...)
Advances the timer and runs the function when necessary.
The information presented in this wiki is not guaranteed to be accurate. The information presented may be a few versions old.