mirror of
https://github.com/mt-mods/mail.git
synced 2025-04-30 16:31:43 -04:00
Remove checks and logging from sorters
This commit is contained in:
parent
b784e9599d
commit
811bd3745a
1 changed files with 2 additions and 12 deletions
14
storage.lua
14
storage.lua
|
@ -64,19 +64,9 @@ function mail.sort_messages(messages, sortfield, descending, filter)
|
||||||
-- Sorting
|
-- Sorting
|
||||||
if sortfield ~= nil then
|
if sortfield ~= nil then
|
||||||
if descending then
|
if descending then
|
||||||
table.sort(results, function(a, b)
|
table.sort(results, function(a, b) return a[sortfield] > b[sortfield] end)
|
||||||
if a[sortfield] and b[sortfield] then
|
|
||||||
return a[sortfield] > b[sortfield]
|
|
||||||
end
|
|
||||||
minetest.log("warning", "mail.sort_messages: missing field "..sortfield)
|
|
||||||
end)
|
|
||||||
else
|
else
|
||||||
table.sort(results, function(a, b)
|
table.sort(results, function(a, b) return a[sortfield] < b[sortfield] end)
|
||||||
if a[sortfield] and b[sortfield] then
|
|
||||||
return a[sortfield] < b[sortfield]
|
|
||||||
end
|
|
||||||
minetest.log("warning", "mail.sort_messages: missing field "..sortfield)
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return results
|
return results
|
||||||
|
|
Loading…
Add table
Reference in a new issue