diff options
-rw-r--r-- | API.md | 1 | ||||
-rw-r--r-- | init.lua | 11 |
2 files changed, 5 insertions, 7 deletions
@@ -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 @@ -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 |