sort by date
having a hell of a time with function
if i only sort by day it works,but when i add month and year it screws everything up this is what i have Code:
function dateSort(dateTable) |
To make things easier for everyone, what does dateTable look like. Do you have an example
Crosspost for reference which also offers a better solution since we're not sure what you are actually trying to do https://us.forums.blizzard.com/en/wo...by-date/558388 |
this the table,new extry is addd when log in and none exists
Code:
SAVES = { edit : should clarify the [] is date ddmmyy,and int is copper player has |
I think you should do what Gello said and store it in a more manageable format. There is probably a better approach to all this
As for sorting your example, this sorts DDMMYY Lua Code:
Code:
110116 51534872357 |
thank you very much,my limited scripting skills ,the code is erroring and i donno what the cause is
|
No one will be able to figure out the cause either if you don't share the error.
|
awesome,got it working all cept the orderis backwards,this si what i have
Code:
function dateSort(dateTable) edit : swapping logic worked,nother bug but closer,thnx ppl |
If you store dates in YYYYMMDD format, you can use table.sort() without a custom function. This greatly improves performance since the entire comparison happens in C code instead of calling your custom Lua function each time it wants to compare two entries.
|
All times are GMT -6. The time now is 10:45 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI