Home  Contents

timer:remaining

Event Core4 Lua Event System

SYNOPSIS

ms = tmr:remaining()

DESCRIPTION

Returns the time that is still remaining until the timer triggers next.

RETURN VALUE

The remaining time in milliseconds.

EXAMPLE

Note that this example uses os.msleep() to show that the timer still runs even with no event loop. Only a callback would not work without the event loop. In normal code, it is recommended to use event:pause() instead of os.msleep().

>  >  >  >  >  > 
app = event.new() tmr = app:timer() tmr:start(1000, true) print(tmr:remaining()) os.msleep(100) print(tmr:remaining())
1000 900

SEE ALSO