diff --git a/mod.lua b/mod.lua index f89c9bd..f545ee2 100644 --- a/mod.lua +++ b/mod.lua @@ -55,6 +55,7 @@ function configuration(modname) modname = modname or minetest.get_current_modname() local schema = modlib.schema.new(assert(include(modname, "schema.lua"))) schema.name = schema.name or modname + local settingtypes = schema:generate_settingtypes() assert(schema.type == "table") local overrides = {} local conf @@ -105,7 +106,7 @@ function configuration(modname) overrides = modlib.table.deep_add_all(overrides, minetest_conf) conf = schema:load(overrides, {convert_strings = true, error_message = true}) end - modlib.file.ensure_content(get_resource(modname, "settingtypes.txt"), schema:generate_settingtypes()) + modlib.file.ensure_content(get_resource(modname, "settingtypes.txt"), settingtypes) local readme_path = get_resource(modname, "Readme.md") local readme = modlib.file.read(readme_path) if readme then diff --git a/schema.lua b/schema.lua index d1b691b..31081a2 100644 --- a/schema.lua +++ b/schema.lua @@ -196,7 +196,7 @@ function load(self, override, params) push(">=", "min") push("<", "max_exclusive") push("<=", "max") - return "out of range: expected value " .. table.concat(conditions, "and") + return "out of range: expected value" .. table.concat(conditions, " and") end if typ == "int" then return "expected integer" @@ -226,8 +226,7 @@ function load(self, override, params) local function error(type, ...) if params.error_message then local formatted = format_error(type, ...) - settingtypes(self) - _error("Invalid value: " .. self.name .. ": " .. formatted) + _error("Invalid value: " .. (self.name and (self.name .. ": ") or "") .. formatted) end _error{ type = type,