Fix luacheck (2)

This commit is contained in:
Athozus 2023-04-05 19:11:57 +02:00
parent 80e8e106e6
commit f387992d46
No known key found for this signature in database
GPG key ID: B50895022E8484BF
3 changed files with 9 additions and 9 deletions

View file

@ -57,7 +57,7 @@ function mail.sort_messages(unsorted_messages, sortfield, sortdirection)
table.insert(messages, unsorted_messages[1]) table.insert(messages, unsorted_messages[1])
table.remove(unsorted_messages, 1) table.remove(unsorted_messages, 1)
-- sort messages -- sort messages
for i, unsorted_msg in ipairs(unsorted_messages) do for _, unsorted_msg in ipairs(unsorted_messages) do
local is_message_sorted = false local is_message_sorted = false
for j, sorted_msg in ipairs(messages) do for j, sorted_msg in ipairs(messages) do
if sortfield == "1" and unsorted_msg.from >= sorted_msg.from then -- for inbox if sortfield == "1" and unsorted_msg.from >= sorted_msg.from then -- for inbox

View file

@ -24,17 +24,17 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
-- then sort them -- then sort them
local sortfield = fields.sortfield local sortfield = tostring(fields.sortfield)
local sortdirection = fields.sortdirection local sortdirection = tostring(fields.sortdirection)
if not sortfield or sortfield == "" or sortfield == "0" then if not sortfield or sortfield == "" or sortfield == "0" then
sortfield = 3 sortfield = "3"
end end
if not sortdirection or sortdirection == "" or sortdirection == "0" then if not sortdirection or sortdirection == "" or sortdirection == "0" then
sortdirection = 1 sortdirection = "1"
end end
local messagesInbox = mail.sort_messages(messagesInboxFiltered, tostring(sortfield), tostring(sortdirection), filter) local messagesInbox = mail.sort_messages(messagesInboxFiltered, sortfield, sortdirection, filter)
local messagesSent = mail.sort_messages(messagesOutboxFiltered, tostring(sortfield), tostring(sortdirection), filter) local messagesSent = mail.sort_messages(messagesOutboxFiltered, sortfield, sortdirection, filter)
if fields.inbox then -- inbox table if fields.inbox then -- inbox table
local evt = minetest.explode_table_event(fields.inbox) local evt = minetest.explode_table_event(fields.inbox)

View file

@ -42,7 +42,7 @@ function mail.show_sent(name, sortfield, sortdirection, filter)
table[0,0.7;5.75,8.35;sent;#999,]] .. S("To") .. "," .. S("Subject") table[0,0.7;5.75,8.35;sent;#999,]] .. S("To") .. "," .. S("Subject")
local formspec = { sent_formspec } local formspec = { sent_formspec }
local entry = mail.get_storage_entry(name) local entry = mail.get_storage_entry(name)
local messages = mail.sort_messages(mail.filter_messages(entry.outbox, filter), tostring(sortfield), tostring(sortdirection)) local messages = mail.sort_messages(mail.filter_messages(entry.outbox, filter), sortfield, sortdirection)
mail.message_drafts[name] = nil mail.message_drafts[name] = nil