I suspect this bug may extend to other functions that allow listeners passed in.
Here’s a line of code that I had in my game…
transition.to( player.sprite, { x = nx, y = ny, time = 2000, onComplete = change\_room\_done( nx, ny) } )
You’ll notice that i am passing parameters into the onComplete listener parameter. The documentation does not say that you cannot pass parameters.
Well, when this line executes, it calls the onComplete function immediately and with the parameters passed!
Deleting the parameters like this…
transition.to( player.sprite, { x = nx, y = ny, time = 2000, onComplete = change\_room\_done } )
…makes it work as expected.
I don’t know why this happens, but there’s no error from Corona when it encounters parameters passed into a function - it just calls it immediately, which screws up the entire callback chain. Tough to debug.
RULE: Don’t put parameters after listener function names!