I’m saving it to system.DocumentsDirectory.
and as far as the file name it’s exactly the same in all its references.
I also used the bit of code you published regarding saving with JSON, and it still didn’t work.
this is what I wrote in the main.lua when the game starts -
path= system.pathForFile(“LMData.json”, system.DocumentsDirectory)
file=io.open(path, “r”)
Data={}
this is what I wrote when I saved the scores-
if(isArcade) then
Data.lastscore_arcade= gameScore
local stringified=json.encode(Data)
file= io.open(path,“w”)
file:write(stringified)
io.close(file)
newHighScore=false
if(Data.highscore_arcade~=nil) then
if(Data.lastscore_arcade>Data.highscore_arcade) and (Data.lastscore_arcade>0) then
Data.highscore_arcade = Data.lastscore_arcade
local stringified=json.encode(Data)
file= io.open(path,“w”)
file:write(stringified)
io.close(file)
newHighScore=true
end
else
Data.highscore_arcade = Data.lastscore_arcade
if(Data.highscore_arcade>0) then
local stringified=json.encode(Data)
file= io.open(path,“w”)
file:write(stringified)
io.close(file)
newHighScore=true
else
Data.highscore_arcade=0
newHighScore=false
end
end
else
Data.lastscore_time= gameScore
local stringified=json.encode(Data)
file= io.open(path,“w”)
file:write(stringified)
io.close(file)
newHighScore=false
if(Data.highscore_time~=nil) then
if(Data.lastscore_time>Data.highscore_time) and (Data.lastscore_time>0) then
Data.highscore_time = Data.lastscore_time
local stringified=json.encode(Data)
file= io.open(path,“w”)
file:write(stringified)
io.close(file)
newHighScore=true
end
else
Data.highscore_time = Data.lastscore_time
if(Data.highscore_time>0) then
local stringified=json.encode(Data)
file= io.open(path,“w”)
file:write(stringified)
io.close(file)
newHighScore=true
else
Data.highscore_time=0
newHighScore=false
end
end
end
I tried both with the save/load functions you suggested in the article, and without them, but it made no difference