mirror of
https://github.com/mt-mods/mail.git
synced 2025-07-15 18:56:47 -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
|
-- storage getter/setter
|
||||||
|
local STORAGE_PREFIX = "mail/"
|
||||||
|
|
||||||
-- create or populate empty fields on an entry
|
-- create or populate empty fields on an entry
|
||||||
local function populate_entry(e)
|
local function populate_entry(e)
|
||||||
|
@ -11,7 +12,7 @@ local function populate_entry(e)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mail.get_storage_entry(playername)
|
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
|
if str == "" then
|
||||||
-- new entry
|
-- new entry
|
||||||
return populate_entry()
|
return populate_entry()
|
||||||
|
@ -23,7 +24,7 @@ function mail.get_storage_entry(playername)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mail.set_storage_entry(playername, entry)
|
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
|
end
|
||||||
|
|
||||||
-- get a mail by id from the players in- or outbox
|
-- get a mail by id from the players in- or outbox
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue