What does the second parameter in table.sort() mean?
I've read through the wiki, as it shows: table.sort (table [, comp])
It states, "If comp is given, then it must be a function that receives two table elements, and returns true when the first is less than the second (so that not comp(a[i+1],a[i]) will be true after the sort). If comp is not given, then the standard Lua operator < is used instead." I have no clue what this means. Could someone possibly give me an example? I'm using this for a table of arrays order in this sort of manner:
5 | [ "1" ] = { "Name" , 45827 , } , |
I had tried sorting them as so, but it did not order the keys from 1 to 5. Instead, it went off the values inside. Could using the second parameter fix this issue, and make it go off converting the key to a number and sorting it so? If so, what would the function be for that?