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:
SAVES = {
["150620"] = 51745398698,
["140620"] = 51547835967,
["130620"] = 51534872357,
["110116"] = 51534872357,
["130619"] = 51534872357,
["250618"] = 51534872357,
["160620"] = 51989680638,
["170620"] = 52179106978,
["150618"] = 51534872357,
["150517"] = 51534872357,
["250518"] = 51534872357,
["110517"] = 51534872357,
}
local t = {}
for timestamp in pairs(SAVES) do
table.insert(t, timestamp)
end
table.sort(t, function(a, b)
local day1, month1, year1 = a:match("(%d%d)(%d%d)(%d%d)")
local day2, month2, year2 = b:match("(%d%d)(%d%d)(%d%d)")
if year1 ~= year2 then
return year1 < year2
elseif month1 ~= month2 then
return month1 < month2
elseif day1 ~= day2 then
return day1 < day2
end
end)
for _, timestamp in pairs(t) do
print(timestamp, SAVES[timestamp])
end
Code:
110116 51534872357
110517 51534872357
150517 51534872357
250518 51534872357
150618 51534872357
250618 51534872357
130619 51534872357
130620 51534872357
140620 51547835967
150620 51745398698
160620 51989680638
170620 52179106978