Hello
I’ve got this simple function:
myObject.switchMove = function(time, x, y, callback) local i = 0 local localCallback = callback local function switchMoveComplete(target) i = i + 1 assert(i \< 2, "DAMN YOU GUYS!") if p.switchMoveTransition then transition.cancel(p.switchMoveTransition) p.switchMoveTransition = nil end if localCallback then localCallback(target) end end p.switchMoveTransition = transition.to(myObject, { time = time, x = x, y = y, transition = easing.inOutQuad, onComplete = switchMoveComplete }) end
As you can see, each time switchMove function is called, a new instance of variable i is created and initiated with 0. A new instance of function switchMoveComplete is created, so there’s no way it’s called from anywhere else than from the transition itself.
Now… after 2 weeks of intensive testing, I just got assertion error “DAMN YOU GUYS!” coming from this line.
Can anyone explain how this could happen, in a different way than by onComplete firing twice?
And no… localCallback does not call switchMove function again.