Hi Alan! Thanks for the response. When I try to compare values in
if currentScore \> highScores[currentLevel] then highScores[currentLevel] = currentScore loadsave.saveTable(highScores, "highScores.json", system.DocumentsDirectory) end
It came up with an error message “attempt to compare nil with number”. In my test code, I’ve setup currentScore to 0 and then increases in value when I tap on a circle object. When I tap once, the previous error message pops up immediately. And then I tried to print highScores[1] to see if it can print out a value with the following code
print ("highScores[1] is " .. highScores[1])
an error message comes up as “attempt to concatenate field ‘?’ (a nil value)”. Can you assist me to whats causing the problem?
EDIT: Oh and I have included the create highScores table to check if its nil like in your second code.