Remove checks and logging from sorters

This commit is contained in:
SX 2023-04-10 13:20:24 +03:00 committed by GitHub
parent d765b40ad0
commit 3407634aef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,19 +64,9 @@ function mail.sort_messages(messages, sortfield, descending, filter)
-- Sorting
if sortfield ~= nil then
if descending then
table.sort(results, function(a, b)
if a[sortfield] and b[sortfield] then
return a[sortfield] > b[sortfield]
end
minetest.log("warning", "mail.sort_messages: missing field "..sortfield)
end)
table.sort(results, function(a, b) return a[sortfield] > b[sortfield] end)
else
table.sort(results, function(a, b)
if a[sortfield] and b[sortfield] then
return a[sortfield] < b[sortfield]
end
minetest.log("warning", "mail.sort_messages: missing field "..sortfield)
end)
table.sort(results, function(a, b) return a[sortfield] < b[sortfield] end)
end
end
return results