mirror of
https://github.com/mt-mods/mail.git
synced 2025-07-13 18:01:54 -04:00
prefix mail entries in the mod storage
This commit is contained in:
parent
48e6a966ee
commit
438cf79a30
1 changed files with 3 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
-- storage getter/setter
|
||||
local STORAGE_PREFIX = "mail/"
|
||||
|
||||
-- create or populate empty fields on an entry
|
||||
local function populate_entry(e)
|
||||
|
@ -11,7 +12,7 @@ local function populate_entry(e)
|
|||
end
|
||||
|
||||
function mail.get_storage_entry(playername)
|
||||
local str = mail.storage:get_string(playername)
|
||||
local str = mail.storage:get_string(STORAGE_PREFIX .. playername)
|
||||
if str == "" then
|
||||
-- new entry
|
||||
return populate_entry()
|
||||
|
@ -23,7 +24,7 @@ function mail.get_storage_entry(playername)
|
|||
end
|
||||
|
||||
function mail.set_storage_entry(playername, entry)
|
||||
mail.storage:set_string(playername, minetest.write_json(entry))
|
||||
mail.storage:set_string(STORAGE_PREFIX .. playername, minetest.write_json(entry))
|
||||
end
|
||||
|
||||
-- get a mail by id from the players in- or outbox
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue