change variables of a scene from another one

Hello everybody,

I started to coding with Corona SDK since this January and i’ve almost completed my first game.

But unfortunately, i’ve encountered some problems, in particular dealing with variables in composer scenes.

I explaining better my problem (I hope): i created with composer three modules named: main.lua, menu.lua and impostazioni.lua (it means options in italian).

From main.lua i go to menu.lua where i have a lot of buttons. One of them is the one that allow me to enter in impostazioni.lua, where i’ve to change the audio options, that is to set the variable music and the variable sound in on or off mode.

The problem is that when i’m in impostazioni.lua and change the values of my variables music and sounds and from here i come back in the module menu.lua, those values seems to be resetted.

Any idea about how to solve?

Thanks

Francesco

Hello

If you only want to persist data between scenes then the easiest method is

https://docs.coronalabs.com/api/library/composer/getVariable.html and https://docs.coronalabs.com/api/library/composer/setVariable.html

You would SET values in your options scene and then GET them in your other scenes

Hello

If you only want to persist data between scenes then the easiest method is

https://docs.coronalabs.com/api/library/composer/getVariable.html and https://docs.coronalabs.com/api/library/composer/setVariable.html

You would SET values in your options scene and then GET them in your other scenes