I have a game where I have a regular score, and a highscore… On the corona simulator, everything works fine, although on my iphone, it doesnt work. I am using an extra script for saving that is called preference.lua(i found it here - http://developer.coronalabs.com/code/save-data-files-tablesnumbersstringsboolean ). Here is my code for scoring and highscoring.
[lua]
–SCORING
score = 0
local function updateScore()
score = score + 1
end
timer.performWithDelay(300, updateScore,
–HIGHSCORING
local preference = require “preference”
highScore = preference.getValue(“a”)
local function updateHighScore()
if (score > highScore) then
preference.save{a = score}
highScore = preference.getValue(“a”)
end
end
timer.performWithDelay(1, updateHighScore, -1)
[/lua]
On the simulator, it saves the highscore and puts it in text, but when it reaches the line to display the highscore, it stops there, which means that either its not saving the value, or something’s wrong in my highScore code(but it works in the simulator).