summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua15
1 files changed, 11 insertions, 4 deletions
diff --git a/init.lua b/init.lua
index 814431e..c0c3c5f 100644
--- a/init.lua
+++ b/init.lua
@@ -20,7 +20,11 @@ function playersettings.openform(player)
if type(player) == "string" then player = minetest.get_player_by_name(player) end
local name = player:get_player_name()
if #playersettings.settingslist < 1 then
- local form = "formspec_version[4]size[12,3]label[0.5,1;No settings currently exist.]label[0.5,1.5;To use the settings menu, one or more mods that provide some settings must be installed.]button_exit[5,2;2,1;quit;Close]"
+ local form = "formspec_version[4]"..
+ "size[12,3.5]"..
+ "label[0.5,1;No settings currently exist.]"..
+ "label[0.5,1.5;To use the settings menu, one or more mods that provide some settings must be installed.]"..
+ "button_exit[5,2;2,1;quit;Close]"
minetest.show_formspec(name,"playersettings:nosettings",form)
return
end
@@ -65,7 +69,10 @@ function playersettings.openform(player)
choices = choices:sub(1,-2)
extras = extras:format(choices,selected)
end
- local form = playersettings.form:format(settingslist,playersettings.highlighted[name],minetest.formspec_escape(def.shortdesc),minetest.formspec_escape(def.longdesc),extras)
+ local highlighted = playersettings.highlighted[name]
+ local shortdesc = minetest.formspec_escape(def.shortdesc)
+ local longdesc = minetest.formspec_escape(def.longdesc)
+ local form = playersettings.form:format(settingslist,highlighted,shortdesc,longdesc,extras)
minetest.show_formspec(name,"playersettings:settings",form)
end
@@ -118,7 +125,7 @@ function playersettings.get(name,setting)
assert(type(setting) == "string",string.format("Invalid setting name (expected string, got %s)",type(setting)))
assert(playersettings.registered[setting],"No such setting: "..setting)
local value = minetest.deserialize(storage:get_string(string.format("%s|%s",name,setting)))
- if value then
+ if value then
return value
else
return playersettings.getdefault(setting)
@@ -156,7 +163,7 @@ function playersettings.onjoin(player)
end
end
-if minetest.get_modpath("unified_inventory") then
+if minetest.global_exists("unified_inventory") then
unified_inventory.register_button("playersettings",
{
action = playersettings.openform,