Hi, I'm looking for a possibly simple way to save a number. I have three buttons: A count up button, A count down button, and a button that changes the scene to a different .lua file. When I input a number using the first two buttons, and then change the scene, the number imputed will reset. How can I save the number? Any help is greatly appreciated.
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
Save a number after changeScene
do you just want to save the number for a single game session ? then you may use a global variable.
you can use it with the global name space
1 | _G.number = yournumber |
Thanks for the reply. I was hoping to be able to save the number until the app is closed. My 'Number' is actually my text + 1. Will the _G still apply?
1 2 3 4 5 6 | function plus(event) if event.phase == "ended" then holScr.text = holScr.text + 1 end end<code> |
Global variable can hold any value just like local variable.
I'm sorry, but I'm a noob, and I don't entirety follow. With this _G, I can cause a .lua file to retain its state even after I reload the app, or change the scene to another .lua file?
views:1331 update:2011/10/11 15:24:38
热门文章
GameCenter LeaderBoards and Achievements Enabled Through OpenFeint
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
相关文章
Metronome Engine, Need some help and ideas from other developers.
Keep text From Going Off Screen
How to make train on railroad tracks?
Why some of my screens are using some much lua memory?
possible to detect physical Android keyboard?
Pause Transition
real beginner question
media.playVideo() troubles when playing videos in sequence
Got error from server: FaultCode" = "-65794";
clicking "agree" on user agreement shuts corona down
Keep text From Going Off Screen
How to make train on railroad tracks?
Why some of my screens are using some much lua memory?
possible to detect physical Android keyboard?
Pause Transition
real beginner question
media.playVideo() troubles when playing videos in sequence
Got error from server: FaultCode" = "-65794";
clicking "agree" on user agreement shuts corona down
corona forums © 2003-2011