Module timer

awesome timer API

Author:

Julien Danjou <julien@danjou.info>

Copyright© 2009 Julien Danjou

Functions

add_signal (name, func) Add a signal.
emit_signal (name, ...) Emit a signal.
remove_signal (name, func) Remove a signal.
start () Start the timer.
stop () Stop the timer.

Tables

timer Timer object.


Functions

add_signal (name, func)
Add a signal.

Parameters

  • name: A signal name.
  • func: A function to call when the signal is emitted.
emit_signal (name, ...)
Emit a signal.

Parameters

  • name: A signal name.
  • ...: Various arguments, optional.
remove_signal (name, func)
Remove a signal.

Parameters

  • name: A signal name.
  • func: A function to remove.
start ()
Start the timer.
stop ()
Stop the timer.

Tables

timer
Timer object. This type of object is useful when triggering events in a repeatedly. The timer will emit the "timeout" signal every N seconds, N being the timeout value.

Fields

  • timeout: Interval in seconds to emit the timeout signal. Can be any value, including floating ones (i.e. 1.5 second).
  • started: Read-only boolean field indicating if the timer has been started.

Valid XHTML 1.0!