Originally Posted by Luzzifus
A working version would be this:
lua Code:
local QuickSort; do local func = function(v1, v2) if not v1 or not v2 then return (v1 and true or false); end if v1[2] ~= v2[2] then return v1[2] < v2[2]; else return v1[1] < v2[1]; end end; QuickSort = function(tbl) table.sort(tbl, func); end end
I wrote that recursive sorting function because I didn't find a way to use table.sort with my data structure. I was also aware of the stack overflow errors it produced but I didn't find a way around it. So I hope it's ok if I use your code as a replacement in cargbags_Nivaya too?
|
I can't see the difference between this code and the one above from SDPhantom. What did you change?
*EDIT*
I added the code from nivaya so it works fine now. Thanks a lot to all parties involved
However, is it possible to add a third sorting? Now it's quality, itemid. Is it possible to add itemcount as a third sort?
And also, how would I go about reversing the quality sort? Now its green > blue > epic. I want to see how it looks the other way.
Its not very important though so don't stress yourself if it's hard ;P