/ finally hopefully fix sorting regardless of ranking value

This commit is contained in:
FajsiEx 2021-12-14 22:22:38 +01:00
parent 86af520c92
commit 0ad3016738
1 changed files with 8 additions and 3 deletions

View File

@ -575,8 +575,8 @@ function drawIrLeaderboard()
end
-- Becuase the scores are in "random order", we have to do this
for i = 1, 4, 1 do
local irScore = irLeaderboard[i];
for index, irScore in ipairs(irLeaderboard) do
-- local irScore = irLeaderboard[i];
if irScore then
local rank = irScore.ranking
@ -682,7 +682,12 @@ end
function onIrLeaderboardFetched(res)
if res.statusCode == IRData.States.Success then
irLeaderboard = res.body;
local tempIrLeaderboard = res.body;
for i, tempScore in ipairs(tempIrLeaderboard) do
irLeaderboard[tempScore.ranking] = tempScore
end
game.Log(dump(irLeaderboard), game.LOGGER_ERROR)
else
game.Log("IR error " .. res.statusCode, game.LOGGER_ERROR)