I can't find it documented anywhere :/
(question is the title)
found this but can't get it to work.
function onCollision( event )
--code--
end
Runtime:addEventListener( "collision", listener )
local function listener( event )
timer.performWithDelay(
1000, onCollision )
end
Your issue is one of code order. function essentially sets the value for the given symbol. From the Lua manual:
The statement
function f () body endtranslates to
f = function () body end
As such, listener is nil at the time you're passing it to addEventListener. Reorder, and it should work:
function onCollision( event )
--code--
end
local function listener( event )
timer.performWithDelay(1000, onCollision )
end
Runtime:addEventListener( "collision", listener )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With