update settings getters
This commit is contained in:
parent
8507a9b80f
commit
ba8d4f2d7d
12
config.lua
12
config.lua
@ -6,6 +6,17 @@ irc2.config = {}
|
|||||||
|
|
||||||
local function setting(stype, name, default, required)
|
local function setting(stype, name, default, required)
|
||||||
local value
|
local value
|
||||||
|
if minetest.settings and minetest.settings.get and minetest.settings.get_bool then
|
||||||
|
-- The current methods for getting settings
|
||||||
|
if stype == "bool" then
|
||||||
|
value = minetest.settings:get_bool("irc2."..name)
|
||||||
|
elseif stype == "string" then
|
||||||
|
value = minetest.settings:get("irc2."..name)
|
||||||
|
elseif stype == "number" then
|
||||||
|
value = tonumber(minetest.settings:get("irc2."..name))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- The old methods for getting settings for backward compatibility. Deprecated on 0.4.16+
|
||||||
if stype == "bool" then
|
if stype == "bool" then
|
||||||
value = minetest.setting_getbool("irc2."..name)
|
value = minetest.setting_getbool("irc2."..name)
|
||||||
elseif stype == "string" then
|
elseif stype == "string" then
|
||||||
@ -13,6 +24,7 @@ local function setting(stype, name, default, required)
|
|||||||
elseif stype == "number" then
|
elseif stype == "number" then
|
||||||
value = tonumber(minetest.setting_get("irc2."..name))
|
value = tonumber(minetest.setting_get("irc2."..name))
|
||||||
end
|
end
|
||||||
|
end
|
||||||
if value == nil then
|
if value == nil then
|
||||||
if required then
|
if required then
|
||||||
error("Required configuration option irc2."..
|
error("Required configuration option irc2."..
|
||||||
|
Loading…
x
Reference in New Issue
Block a user