Table Sort Headache
Im getting a headache with this haha
I have a table of raid subs, but of course they are added to the table as they come in. Table is like this.. Code:
["subsList"] = { Any ideas? |
You can't reliably sort a hash table because the returns you receive when iterating it aren't necessarily going to be in sorted order. Use an array instead, or add an additional data structure.
Code:
subsList = { Code:
local first = subsList[sorted[1]] |
Or you just make it an array from the start...
Code:
["subsList"] = { Code:
table.sort(sometable.subsList, function(a,b) return a.toon > b.toon end) |
Out of curiosity: may I ask why you are storing timestamps in two different formats? If it's for GUI purposes, you could always pass "added" and "updated" (or time() itself) as the second argument to date().
Code:
date("%I:%M:%S", time()) --> 01:06:56 |
All times are GMT -6. The time now is 09:15 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI