Does anyone know how to pass variables from one scene to another? [import]uid: 30185 topic_id: 5711 reply_id: 305711[/import]
Nevermind, solved it [import]uid: 30185 topic_id: 5711 reply_id: 19571[/import]
You can use global variables, database or a lua file (package) to store them. [import]uid: 8556 topic_id: 5711 reply_id: 19639[/import]
Solved it with global variables Thanks though! [import]uid: 30185 topic_id: 5711 reply_id: 19655[/import]
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?
[import]uid: 26664 topic_id: 5711 reply_id: 22213[/import]
Those are not real globals. Try use _G.newGame / _G.gameRound instead [import]uid: 30185 topic_id: 5711 reply_id: 22243[/import]