Type Function Library timer.* Revision 2017.3060 Keywords timer, delay, cancel See also timer.performWithDelay()
Cancels a timer operation initiated with timer.performWithDelay().
timer.cancel( timerID )
Object. Handle returned by the call to timer.performWithDelay().
local t = {}
function t:timer( event )
local count = event.count
print( "Table listener called " .. count .. " time(s)" )
if count >= 3 then
timer.cancel( event.source ) -- after 3rd invocation, cancel timer
end
end
-- Register to call t's timer method an infinite number of times
timer.performWithDelay( 1000, t, 0 )