mtimer/system/get_options.lua
2017-07-28 18:59:33 +02:00

15 lines
451 B
Lua

local path = minetest.get_modpath(minetest.get_current_modname())
local file = io.open(path..DIR_DELIM..'settingtypes.txt', 'rb')
local result = {}
for line in file:lines() do
if line:match("^([a-zA-Z])") then
local name = line:gsub(' .+', '')
local default_value = line:gsub('^[^ ]+ %b() %a+ ', '')
local set_value = minetest.setting_get(name)
result[name] = set_value or default_value
end
end
return result