Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

Commit

Permalink
Fix broken assert()
Browse files Browse the repository at this point in the history
  • Loading branch information
kilbith committed Mar 20, 2019
1 parent 4c0371c commit 9dc656d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 9dc656d

Please sign in to comment.