validate building-names
This commit is contained in:
parent
9a72a7518f
commit
28c82181e3
9
api.lua
9
api.lua
@ -20,6 +20,15 @@ function building_lib.register_building(name, def)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local parts = string.split(name, ":")
|
||||||
|
if #parts ~= 2 then
|
||||||
|
error("building-name invalid: '" .. name .. "' should be in the form: 'modname:building_name'")
|
||||||
|
end
|
||||||
|
|
||||||
|
if parts[1] ~= minetest.get_current_modname() then
|
||||||
|
error("unexpected modname: '" .. parts[1] .. "' expected: " .. minetest.get_current_modname())
|
||||||
|
end
|
||||||
|
|
||||||
buildings[name] = def
|
buildings[name] = def
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user