mirror of
https://github.com/mt-mods/mail.git
synced 2025-04-30 16:31:43 -04:00
Optimize stored setting value getting
Co-authored-by: SX <50966843+S-S-X@users.noreply.github.com>
This commit is contained in:
parent
a2d680eda8
commit
abd75e8a31
1 changed files with 3 additions and 4 deletions
|
@ -399,10 +399,9 @@ end
|
||||||
|
|
||||||
function mail.get_setting(playername, key)
|
function mail.get_setting(playername, key)
|
||||||
local entry = mail.get_storage_entry(playername)
|
local entry = mail.get_storage_entry(playername)
|
||||||
local value = mail.get_setting_default_value(key)
|
local value = entry.settings[key] == nil
|
||||||
if entry.settings[key] ~= nil then
|
and mail.get_setting_default_value(key)
|
||||||
value = entry.settings[key]
|
or entry.settings[key]
|
||||||
end
|
|
||||||
|
|
||||||
if mail.settings[key].sync then -- in case this setting is shared with another mod
|
if mail.settings[key].sync then -- in case this setting is shared with another mod
|
||||||
value = mail.settings[key].sync(playername, key) -- get new value
|
value = mail.settings[key].sync(playername, key) -- get new value
|
||||||
|
|
Loading…
Add table
Reference in a new issue