Thread: Tables again...
View Single Post
12-26-19, 12:28 AM   #11
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Originally Posted by Roeshambo View Post
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
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 12-26-19 at 12:38 AM.
  Reply With Quote