I’m trying to cancel a timer but it doesn’t get canceled when it should, and each time a touch event occurs, a new timer gets added:
local fireTimer local function onTouch( event ) if( event.phase == "began") then fireTimer = timer.performWithDelay( 3000, fire, 0 ) \<-- works fine elseif( event.phase == "ended" ) then timer.cancel( fireTimer ) \<-- doesn't work, it keeps going, "pause" doesn't work either end end
player:addEventListener( "touch", onTouch )