mirror of
https://github.com/minetest-mods/craftguide.git
synced 2024-11-29 22:03:42 +01:00
Fix broken assert()
This commit is contained in:
parent
4c0371c5cc
commit
9dc656d5a2
12
init.lua
12
init.lua
@ -124,6 +124,14 @@ local function is_str(x)
|
|||||||
return type(x) == "string"
|
return type(x) == "string"
|
||||||
end
|
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)
|
local function is_func(x)
|
||||||
return type(x) == "function"
|
return type(x) == "function"
|
||||||
end
|
end
|
||||||
@ -142,9 +150,9 @@ end
|
|||||||
function craftguide.register_craft(def)
|
function craftguide.register_craft(def)
|
||||||
local func = "craftguide." .. __func() .. "(): "
|
local func = "craftguide." .. __func() .. "(): "
|
||||||
assert(is_str(def.type), func .. "'type' field missing")
|
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.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
|
custom_crafts[#custom_crafts + 1] = def
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user