From 9dc656d5a22f7cd7739fc3d36b804aa1577b5d5a Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Thu, 21 Mar 2019 00:21:11 +0100 Subject: [PATCH] Fix broken assert() --- init.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 263c043..cd85f77 100644 --- a/init.lua +++ b/init.lua @@ -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