How do I pass variables with directors class?

Does anyone know how to pass variables from one scene to another?

Nevermind, solved it

You can use global variables, database or a lua file (package) to store them.

Solved it with global variables :) Thanks though!

Maybe I missed something, but my global variables are not going from one module to another?

I have:

newGame = true
gameRound = 0

in mainmenu.lua

and when pushing the button and using director:changeScene("game") newGame and gameRound are equal to nil?

Those are not real globals. Try use _G.newGame / _G.gameRound instead :)

views:1232 update:2011/10/13 9:25:17
corona forums © 2003-2011