I have a key => value table I\'d like to sort in Lua. The keys are all integers, but aren\'t consecutive (and have meaning). Lua\'s only sort function appears to be table.
I did a brief bit of Lua coding a couple of years ago but I'm no longer fluent in it.
When faced with a similar problem, I copied my array to another array with keys and values reversed, then used sort on the new array.
I wasn't aware of a possibility to sort the array using the method Kornel Kisielewicz recommends.