Fix broken assert()

This commit is contained in:
Jean-Patrick Guerrero 2019-03-21 00:21:11 +01:00
parent 4c0371c5cc
commit 9dc656d5a2

View File

@ -124,6 +124,14 @@ local function is_str(x)
return type(x) == "string"
end
local function is_num(x)
return type(x) == "number"
end
local function is_table(x)
return type(x) == "table"
end
local function is_func(x)
return type(x) == "function"
end
@ -142,9 +150,9 @@ end
function craftguide.register_craft(def)
local func = "craftguide." .. __func() .. "(): "
assert(is_str(def.type), func .. "'type' field missing")
assert(is_str(def.width), func .. "'width' field missing")
assert(is_num(def.width), func .. "'width' field missing")
assert(is_str(def.output), func .. "'output' field missing")
assert(is_str(def.items), func .. "'items' field missing")
assert(is_table(def.items), func .. "'items' field missing")
custom_crafts[#custom_crafts + 1] = def
end