Saving and Loading the Score (Adding a Highscore)

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

Hello guys, I managed to get the score system going and would like to know how to add a highscore system. I was thinking about making the score save if it is greater than the saved score and using the display saved score to show the highscore but I don’t know how to use the commands. I have googled other highscore systems but they are way different.

I am making a gameover on collision game. 

This is my mini score system going.

local score = require('classes.score') local scoreText = score.init( { fontSize = 20, font = "", x = display.contentCenterX, y = 30, maxDigits = 4, leadingZeros = false }) local updateScore = function() score.add( 1 ) end scoreTimer = timer.performWithDelay( 10, updateScore, -1)

While I am not 100% sure if I follow you completely, checking if the current score is higher than the stored highscore is quite simple. I haven’t seen this tutorial or style before and I create leaderboards in my games a bit different, but following the tutorial’s style, you could do something like this:
 

-- on gameover local currentScore = score.get() local savedScore = score.load() if currentScore \> savedScore then score.save() end

 

While I am not 100% sure if I follow you completely, checking if the current score is higher than the stored highscore is quite simple. I haven’t seen this tutorial or style before and I create leaderboards in my games a bit different, but following the tutorial’s style, you could do something like this:
 

-- on gameover local currentScore = score.get() local savedScore = score.load() if currentScore \> savedScore then score.save() end