summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--API.md1
-rw-r--r--init.lua11
2 files changed, 5 insertions, 7 deletions
diff --git a/API.md b/API.md
index 2731710..2ac6a34 100644
--- a/API.md
+++ b/API.md
@@ -224,6 +224,7 @@ Add a custom factoid (see above) for the specified category.
* `"nodes"`: Blocks
* `"tools"`: Tools and weapons
* `"craftitems"`: Misc. items
+ * `nil`: All of the above
* `factoid_type`: Rough categorization of the factoid's content. Controls
where in the text the factoid appears. Possible values:
* `"groups"`: Factoid appears near groups
diff --git a/init.lua b/init.lua
index 45121df..4ba6f88 100644
--- a/init.lua
+++ b/init.lua
@@ -270,16 +270,13 @@ end
function doc.sub.items.register_factoid(category_id, factoid_type, factoid_generator)
local ftable = { fgen = factoid_generator, ftype = factoid_type }
- if category_id == "nodes" then
- table.insert(factoid_generators.nodes, ftable)
+ if category_id == "nodes" or category_id == "tools" or category_id == "craftitems" then
+ table.insert(factoid_generators[category_id], ftable)
return true
- elseif category_id == "tools" then
+ elseif category_id == nil then
+ table.insert(factoid_generators.nodes, ftable)
table.insert(factoid_generators.tools, ftable)
- return true
- elseif category_id == "craftitems" then
table.insert(factoid_generators.craftitems, ftable)
- return true
- else
return false
end
end