diff options
author | Wuzzy <almikes@aol.com> | 2016-12-09 07:04:34 +0100 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2016-12-09 07:04:34 +0100 |
commit | f36ed19df39c7f59c8cc99b8074bc5e4252ab3b9 (patch) | |
tree | 0297cce455be3b1ad2625c2b28507deebb8436ec | |
parent | 0ed6eb4951eb31b2f3b48c70514bf787a57cece0 (diff) |
Allow category_id in register_factoid to be nil
-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 |