Home Contents | # timer:start | Event | Core4 Lua Event System

## SYNOPSIS

1. tmr:start(ms[, mode])
2. tmr:restart(ms[, mode])

## DESCRIPTION

Starts the timer with a timeout value of ms milliseconds.
if mode is "single", the timer triggers once after the timeout has elapsed, then stops. If it is "auto" the timer will cyclically trigger until stopped by calling timer:stop(). The default mode is single shot.

By default, the timer starts counting from the moment that timer:start() is called. When using the tmr:restart() function, however, the time in ms is seen relative to the last time the timer has triggered. This avoids "losing time" between a single-shot timer triggering and starting the next time sequence.

When the timer expires, it's callback is called, see event:timer().

## NOTES

Callbacks are called from within event:poll().

## EXAMPLE

See event:timer().

## SEE ALSO

timer:close, timer:isActive, timer:remaining, timer:stop