mirror of
https://github.com/mt-mods/mail.git
synced 2025-07-14 02:11:55 -04:00
Fix luacheck (2)
This commit is contained in:
parent
80e8e106e6
commit
f387992d46
3 changed files with 9 additions and 9 deletions
|
@ -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
|
||||||
|
|
|
@ -7,7 +7,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
|
||||||
-- split inbox and sent msgs for different tests
|
-- split inbox and sent msgs for different tests
|
||||||
local entry = mail.get_storage_entry(name)
|
local entry = mail.get_storage_entry(name)
|
||||||
|
|
||||||
local messagesInboxUnAnalyzed = entry.inbox
|
local messagesInboxUnAnalyzed = entry.inbox
|
||||||
local messagesOutBoxUnAnalyzed = entry.outbox
|
local messagesOutBoxUnAnalyzed = entry.outbox
|
||||||
local messagesDrafts = entry.drafts
|
local messagesDrafts = entry.drafts
|
||||||
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue