fix mail.delete_mail (again)

This commit is contained in:
Buckaroo Banzai 2023-06-06 07:02:57 +02:00
parent 42db40b7a7
commit de07f6b24b

View File

@ -114,30 +114,27 @@ function mail.delete_mail(playername, msg_ids)
if type(msg_ids) ~= "table" then -- if this is not a table if type(msg_ids) ~= "table" then -- if this is not a table
msg_ids = { msg_ids } msg_ids = { msg_ids }
end end
if #entry.inbox > 0 then for i = #entry.inbox, 1, -1 do
for i = #entry.inbox, 1, -1 do for _, deleted_msg in ipairs(msg_ids) do
for _, deleted_msg in ipairs(msg_ids) do if entry.inbox[i].id == deleted_msg then
if entry.inbox[i].id == deleted_msg then table.remove(entry.inbox, i)
table.remove(entry.inbox, i) break
end
end end
end end
end end
if #entry.outbox > 0 then for i = #entry.outbox, 1, -1 do
for i = #entry.outbox, 1, -1 do for _, deleted_msg in ipairs(msg_ids) do
for _, deleted_msg in ipairs(msg_ids) do if entry.outbox[i].id == deleted_msg then
if entry.outbox[i].id == deleted_msg then table.remove(entry.outbox, i)
table.remove(entry.outbox, i) break
end
end end
end end
end end
if #entry.drafts > 0 then for i = #entry.drafts, 1, -1 do
for i = #entry.drafts, 1, -1 do for _, deleted_msg in ipairs(msg_ids) do
for _, deleted_msg in ipairs(msg_ids) do if entry.drafts[i].id == deleted_msg then
if entry.drafts[i].id == deleted_msg then table.remove(entry.drafts, i)
table.remove(entry.drafts, i) break
end
end end
end end
end end