- tmr = app:timer([callback])
- functioncallback(tmr) ...
SYNOPSIS
DESCRIPTION
Sets up a timer instance. A timer can be started with timer:start() and stopped with timer:stop(). The state of the timer state can be queried using timer:remaining() and timer:isActive(). When the optional callback function is given, it is called when the timer's timeout has expired, with the timer itself as a parameter.
RETURN VALUE
A new timer instance.
NOTES
Callbacks are called from within event:poll().
EXAMPLE
This prints tock once a second.
>
>
>
>
>
>
>
>
>
>
>
>
app = event.new()
function tock()
print("tock")
end
tmr = app:timer(tock)
tmr:start(1000, false)
while true do
app:poll()
end