As you say, non-numerically indexed tables are not ordered. So you have 2 options.
Option 1) Make an ordered reference table
In general, say you always wanted to print Red then White then Pink then Orange. You just make a table {"Red", "White", "Pink", "Orange"} and then loop over that table to get the keys in the order you want, and pull from tableofStuff with the given key. However, it looks like you want to sort by score. In which case, option 2 is more what you need.
Option 2) Sorting ordered tables
You keep your data in an ordered table in the first place, or place it into one when it comes time to sort. That would look like this:
Code:
scoreList = {
{color="Red", score=55},
{you get the idea},
{you get the idea},
{you get the idea},
}
Then you run a sorting function on it to order the entries.
Code:
--Sorts table
local sort_func = function(a,b) return a["score"] > b["score"] end
table.sort(scoreList, sort_func)
And now you have an ordered list that has the entries sorted into the order you desire.
EXAMPLE: [url]https://ideone.com/ATMaXA[/url]