Replaced early returns with error calls

This commit is contained in:
the-real-herowl 2024-04-30 03:53:49 +02:00
parent e0aadc7996
commit ee2998e21b

View file

@ -6,17 +6,17 @@ vl_hollow_logs = {}
---@param defs table {name:string, stripped_name>string, desc:string, stripped_desc:string, not_flammable:boolean|nil} ---@param defs table {name:string, stripped_name>string, desc:string, stripped_desc:string, not_flammable:boolean|nil}
function vl_hollow_logs.register_hollow_log(defs) function vl_hollow_logs.register_hollow_log(defs)
if not defs or #defs < 4 then if not defs or #defs < 4 then
return error("Incomplete definition provided")
end end
for i = 1, #defs do for i = 1, #defs do
if i == 5 then if i == 5 then
if type(defs[i]) ~= "boolean" and type(defs[i]) ~= "nil" then if type(defs[i]) ~= "boolean" and type(defs[i]) ~= "nil" then
return error("Invalid arg #5")
end end
else else
if type(defs[i]) ~= "string" then if type(defs[i]) ~= "string" then
return error("Invalid arg #".. tostring(i))
end end
end end
end end