I am currently developing a game in which players can score other players. At the end of the round, all the scores are tallied into a variable called FinalScores. This is a dictionary, here’s an example of what it could look like at the end of a round:
I’ve been trying to work out a way to sort this dictionary so I can get the placings of each players, and I haven’t found a solution yet. Storing them in an array doesn’t necessarily work in this case, because 2 players may have the same score.
Those are methods you can use to sort large amounts of data if table.sort() doesn’t work for what you need. It’s a bit more complex than just using sort though.
So basically what my example does is it checks if the 2nd key of the first table is greater than the 2nd key of the second table and will automatically sort it.