diff --git a/scripts/songselect/songwheel.lua b/scripts/songselect/songwheel.lua index cfd620d..a14bd87 100644 --- a/scripts/songselect/songwheel.lua +++ b/scripts/songselect/songwheel.lua @@ -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)