diff --git a/lovebird.lua b/lovebird.lua index 81f7d6d..2237bbb 100644 --- a/lovebird.lua +++ b/lovebird.lua @@ -346,7 +346,7 @@ lovebird.pages["env.json"] = [[ table.insert(keys, k) end end - table.sort(keys, function(a, b) return tostring(a) < tostring(b) end) + table.sort(keys, lovebird.compare) for _, k in pairs(keys) do local v = t[k] ?> @@ -447,6 +447,18 @@ function lovebird.truncate(str, len) end +function lovebird.compare(a, b) + local na, nb = tonumber(a), tonumber(b) + if na then + if nb then return na < nb end + return false + elseif nb then + return true + end + return tostring(a) < tostring(b) +end + + function lovebird.checkwhitelist(addr) if lovebird.whitelist == nil then return true end for _, a in pairs(lovebird.whitelist) do