0

情况是我需要访问调用 eventListener 的对象

例如:如果我要添加:balls[ball]:addEventListener( "collision", removeBricks)如何balls[ball]在 removeBricks 函数中访问?

function removeBricks(event)
    print("caller: " .. balls[ball])
    ...
end
balls[ball]:addEventListener( "collision", removeBricks)

我试过的:

balls["ball"]:addEventListener( "collision", removeBricks(event, balls["ball"]))                
4

1 回答 1

0
self -> balls[ball]
event.other -> other collided object
于 2013-07-04T14:01:59.890 回答