Lysa  0.0
Lysa 3D Engine
Timer Class Referenceabstract

Detailed Description

One-shot or repeating countdown timer that fires a callback when its wait time elapses.

Lua full name: lysa.Timer

Public Member Functions

nil start ()
 Starts or restarts the timer. More...
 
nil stop ()
 Stops the timer without firing the callback. More...
 
nil set_callback (fn: fun()|nil)
 Sets (or clears with nil) the Lua function invoked on each timeout, replacing any previously set callback. More...
 

Properties

boolean is_stopped
 True if the timer is neither running nor waiting to fire. (read-only)
 
number wait_time
 Delay in seconds before the callback fires; takes effect on the next start().
 
boolean one_shot
 True to stop after the first timeout, false to repeat indefinitely until stop() is called; takes effect on the next start().
 

Member Function Documentation

nil start ( )

Starts or restarts the timer.

nil stop ( )

Stops the timer without firing the callback.

nil set_callback ( fun()|nil  fn)

Sets (or clears with nil) the Lua function invoked on each timeout, replacing any previously set callback.

Parameters
fnfun()|nil

Property Documentation

boolean is_stopped

True if the timer is neither running nor waiting to fire. (read-only)

number wait_time

Delay in seconds before the callback fires; takes effect on the next start().

boolean one_shot

True to stop after the first timeout, false to repeat indefinitely until stop() is called; takes effect on the next start().