是否有办法提及目前在卢阿执行匿名职能? 就像我们在 Java里可以做的那样,用arguments.questee
。
例如:
local function newLiftAnimator(obj)
local count = 0
return function(event)
-- animate obj s properties here on each "enterFrame" event
obj.y = obj.y - 1
count = count + 1
-- when done, remove event listener
if count >= 100 then
Runtime:removeEventListener("enterFrame", **<this_function>**)
end
end
end
Runtime:addEventListener("enterFrame", newLiftAnimator(ball))