Starting and stopping a timer with a collision handler problems

Hi all, I’m having problems with this concept

local function onLocalCollision( self, event ) if ( event.phase == "began" ) then print( self.myName .. ": collision began with " .. event.other.myName ) timerOne = timer.performWithDelay(3000, someFunction) elseif ( event.phase == "ended" ) then print( self.myName .. ": collision ended with " .. event.other.myName ) timer.cancel(timerOne) end end

Any help would be greatly appreciated. Thanks

local function onLocalCollision( self, event ) if ( event.phase == "began" ) then print( self.myName .. ": collision began with " .. event.other.myName ) self.myTimer = timer.performWithDelay(3000, function() self.myTimer = nil; someFunction() end ) elseif ( event.phase == "ended" ) then print( self.myName .. ": collision ended with " .. event.other.myName ) if( self.myTimer ) then self.myTimer = nil timer.cancel(self.myTimer) end end end
local function onLocalCollision( self, event ) if ( event.phase == "began" ) then print( self.myName .. ": collision began with " .. event.other.myName ) self.myTimer = timer.performWithDelay(3000, function() self.myTimer = nil; someFunction() end ) elseif ( event.phase == "ended" ) then print( self.myName .. ": collision ended with " .. event.other.myName ) if( self.myTimer ) then self.myTimer = nil timer.cancel(self.myTimer) end end end