Hello,
Below is an example of what I am trying to achieve. Will the code leak? Because I didn’t clear off the function, or do I need to?
-- tap event to remove self local function onTap( event ) event.target:removeSelf() end -- add function local function testAddFunction( obj ) function obj:SayHello() print( "Hello" ) end end -- main local function main() local obj = display.newImage( "man.png" ) testAddFunction( obj ) obj:addEventListener( "tap", onTap ) end