timer.cancelAll()

Type Function
Library timer.*
Revision Release 2024.3703
Keywords timer, delay, cancel
See also timer.cancel()

Overview

Cancels all timer operations initiated with timer.performWithDelay().

Gotchas

Using timer.cancelAll() requires Solar2D 2020.3611 or a newer build.

For multiple timers, a tag or id is needed to use timer.resumeAll(), timer.pauseAll(), or timer.cancelAll()

Syntax

timer.cancelAll()

Example

local function listener( event )
    print( "listener called" )
end

timer1 = timer.performWithDelay( 2000, listener )  -- wait 2 seconds
timer2 = timer.performWithDelay( 3000, listener )  -- wait 3 seconds

-- sometime later...
timer.cancelAll()