Type Function Library timer.* Return value Number Revision Release 2022.3683 Keywords timer, pause, resume See also timer.resume()
timer.performWithDelay()
Pauses a specific timer or all timers with the same tag that were started with timer.performWithDelay().
If a specific timer is paused, then the function returns a number that represents the amount of time remaining, in milliseconds.
timer.pause( whatToPause )
Object or String. The timer ID from, or tag
passed to, timer.performWithDelay(). Note: Using tag
requires Solar2D 2020.3611
or a newer build.
local function listener( event ) print( "listener called" ) end timer1 = timer.performWithDelay( 2000, listener ) -- wait 2 seconds -- sometime later... local result = timer.pause( timer1 ) print( "Time remaining is " .. result )
local function listener( event ) print( "listener called" ) end timer1 = timer.performWithDelay( 2000, listener, "red" ) -- wait 2 seconds timer2 = timer.performWithDelay( 3000, listener, "blue" ) -- wait 3 seconds -- sometime later... timer.pause( "red" )