mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 12:01:06 +01:00
Definition validation improved
This commit is contained in:
parent
a25e2b8eb3
commit
b9428e3438
1 changed files with 10 additions and 9 deletions
|
@ -9,17 +9,18 @@ function vl_hollow_logs.register_hollow_log(defs)
|
||||||
error("Incomplete definition provided")
|
error("Incomplete definition provided")
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = 1, #defs do
|
for i = 1, 4 do
|
||||||
if i == 5 then
|
if type(defs[i]) ~= "string" then
|
||||||
if type(defs[i]) ~= "boolean" and type(defs[i]) ~= "nil" then
|
error("defs["..i.."] must be a string")
|
||||||
error("Invalid arg #5")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if type(defs[i]) ~= "string" then
|
|
||||||
error("Invalid arg #".. tostring(i))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if defs[5] and type(defs[5]) ~= "boolean" then
|
||||||
|
error("defs[5] must be a boolean if present")
|
||||||
|
end
|
||||||
|
if #defs > 5 then
|
||||||
|
minetest.log("warning", "[vl_hollow_logs] unused vars passed, dumping the table")
|
||||||
|
minetest.log("warning", dump(defs))
|
||||||
|
end
|
||||||
|
|
||||||
local name = defs[1]
|
local name = defs[1]
|
||||||
local stripped_name = defs[2]
|
local stripped_name = defs[2]
|
||||||
|
|
Loading…
Reference in a new issue