pass variable information between lua files/scenes

Hello 

I am making a game and am trying to implement a menu scene where the player selects the difficulty.  When the player selects the difficulty he gets moved onto the main game.  The only information I want the difficulty to pass to the main game is a time variable 60, 45 ,30 seconds etc. 

My question is how can I pass the information between the two lua files/scenes.

 

I have attached a simple picture to show what i mean.

 

 

Thanking You

I recommend this method: http://www.coronalabs.com/blog/2013/05/28/tutorial-goodbye-globals/

However, if you want to save the difficulty setting to disk for further app launches then I recommend GGData.

In ‘goodbye globals’ tutorial check part about ‘myData’.
The idea is basing on fact that in lua tables are passed by reference. So you create table in one file and share this table between other files. Because you will be always refering to the same table, you can add to it any variable and from anywhere you access table variables will be there

If you are using Storyboard as your scene manager, it can pass parameters  through the storyboard.gotoScene() call as well, but I would have to say the myData method is probably the easiest.

I recommend this method: http://www.coronalabs.com/blog/2013/05/28/tutorial-goodbye-globals/

However, if you want to save the difficulty setting to disk for further app launches then I recommend GGData.

In ‘goodbye globals’ tutorial check part about ‘myData’.
The idea is basing on fact that in lua tables are passed by reference. So you create table in one file and share this table between other files. Because you will be always refering to the same table, you can add to it any variable and from anywhere you access table variables will be there

If you are using Storyboard as your scene manager, it can pass parameters  through the storyboard.gotoScene() call as well, but I would have to say the myData method is probably the easiest.