mirror of
https://github.com/minetest-mods/MoreMesecons.git
synced 2024-08-20 05:04:09 +02:00
moremesecons.setting: remove pointless val_under_min parameter
This commit is contained in:
parent
ea81d826b9
commit
b60a719b14
@ -1,6 +1,6 @@
|
|||||||
moremesecons = {}
|
moremesecons = {}
|
||||||
|
|
||||||
function moremesecons.setting(modname, settingname, default, min, val_under_min)
|
function moremesecons.setting(modname, settingname, default, min)
|
||||||
local setting = "moremesecons_" .. modname .. "." .. settingname
|
local setting = "moremesecons_" .. modname .. "." .. settingname
|
||||||
|
|
||||||
if type(default) == "boolean" then
|
if type(default) == "boolean" then
|
||||||
@ -14,14 +14,12 @@ function moremesecons.setting(modname, settingname, default, min, val_under_min)
|
|||||||
elseif type(default) == "number" then
|
elseif type(default) == "number" then
|
||||||
local ret = tonumber(minetest.setting_get(setting)) or default
|
local ret = tonumber(minetest.setting_get(setting)) or default
|
||||||
if ret ~= ret then -- NaN
|
if ret ~= ret then -- NaN
|
||||||
minetest.log("warning", "[moremesecons_"..modname.."]: setting '"..setting.."' is NaN. Set to default value "..tostring(default)..".")
|
minetest.log("warning", "[moremesecons_"..modname.."]: setting '"..setting.."' is NaN. Set to default value ("..tostring(default)..").")
|
||||||
ret = default
|
ret = default
|
||||||
end
|
end
|
||||||
if min then
|
if min and ret < min then
|
||||||
if ret < min then
|
minetest.log("warning", "[moremesecons_"..modname.."]: setting '"..setting.."' is under minimum value "..tostring(min)..". Set to minimum value ("..tostring(min)..").")
|
||||||
minetest.log("warning", "[moremesecons_"..modname.."]: setting '"..setting.."' is under minimum value "..tostring(min)..". Set to "..tostring(val_under_min or min)..".")
|
ret = min
|
||||||
ret = val_under_min or min
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user