settings.lua 445 B

12345678910111213141516
  1. -- SETTINGS
  2. function mesecon.setting(setting, default)
  3. if type(default) == "boolean" then
  4. local read = minetest.settings:get_bool("mesecon."..setting)
  5. if read == nil then
  6. return default
  7. else
  8. return read
  9. end
  10. elseif type(default) == "string" then
  11. return minetest.settings:get("mesecon."..setting) or default
  12. elseif type(default) == "number" then
  13. return tonumber(minetest.settings:get("mesecon."..setting) or default)
  14. end
  15. end