Loading Saved Score

http://docs.coronalabs.com/tutorial/games/keepScores/index.html#saving-and-loading-the-score

Hello guys, how do I get the saved score to display? I have no clue how to use the command.

When you call the .init() function of the module, a display.newText() object is created, drawn on screen and that object is returned to you so you can later access all of the display.newText() methods and properties.

You shouldn’t need to do anything other than calling the .init() method. Then when you want to update the score, call either the .set() or .add() function.

Rob

Thanks a lot Rob! It seems to be working properly.

Here is the code I used.

local score = require( "classes.score" ) local scoreText = score.init( { fontSize = 20, font = "", x = 30, y = 30, maxDigits = 4, leadingZeros = false }) local savedScore = score.load() score.set( savedScore )

When you call the .init() function of the module, a display.newText() object is created, drawn on screen and that object is returned to you so you can later access all of the display.newText() methods and properties.

You shouldn’t need to do anything other than calling the .init() method. Then when you want to update the score, call either the .set() or .add() function.

Rob

Thanks a lot Rob! It seems to be working properly.

Here is the code I used.

local score = require( "classes.score" ) local scoreText = score.init( { fontSize = 20, font = "", x = 30, y = 30, maxDigits = 4, leadingZeros = false }) local savedScore = score.load() score.set( savedScore )