i have a timer in a class i every time i try this there is the Error : function expected, got nil
i dont know why
dave= Core.class(Sprite)
local fall_timer = Timer.new(10,0)
function dave:init()
fall_timer:addEventListener(Event.TIMER, self.onJumpFallTimer )
end
function dave:onJumpFallTimer()
-- Do something...
end
Comments
You must have used self in the dave:onJumpFallTimer function that you have not pass through the fall_timer:addEventListener
I think just change to fall_timer:addEventListener(Event.TIMER, self.onJumpFallTimer, self ) will works.
https://sites.google.com/site/xraystudiogame
cause the error even with self at the end and the function is emtpy same thing
lua:53: bad argument #2 to 'addEventListener' (function expected, got nil)
Unfortunately, without seeing more code, we can't really help you