Estoy intentando comparar las tablas score[1] y highscore[1] para obtener la puntuación más alta y grabarla en highscore.json pero no me funciona. ¿Alguien me puede ayudar? Gracias
local function onCollision_1(event)
if event.phase == "began" then
local agro = event.object1
local hit = event.object2
if agro.type == "ball" and hit.type == "exit" then
elseif agro.type == "exit" and hit.type == "ball" then
initialtime.text = initialtime.text + clockText.text
score = {}
highscore = {}
highscore[1] = initialtime.text
score[1] = initialtime.text
loadsave.saveTable(score, "score.json", system.DocumentsDirectory)
score = loadsave.loadTable("score.json", system.DocumentsDirectory)
if score[1] > highscore[1] then
loadsave.saveTable(highscore, "highscore.json", system.DocumentsDirectory)
highscore = loadsave.loadTable("highscore.json", system.DocumentsDirectory)
else
end
showpoints = function()
storyboard.gotoScene("play", "fade", 800) end
timer.performWithDelay(2000, showpoints)
end
end
end