Originally Posted by Roeshambo
Where as in an associative array, if you sort it, you're going to have to use "next" or "for k,v" to cycle through it in the proper order.
|
table.sort() doesn't work on associative keys. It only works on the sequential portion of the table. The order of key/value pairs iterated from
next() and
pairs() are completely random. Even among sequential keys. This is why
ipairs() exists instead of using
pairs() for that too.
https://www.lua.org/manual/5.1/manua...pdf-table.sort