Registered definitions¶
Anything added using certain [Registration functions] gets added to one or more of the global [Registered definition tables].
Note that in some cases you will stumble upon things that are not contained in these tables (e.g. when a mod has been removed). Always check for existence before trying to access the fields.
Example:
All nodes register with core.register_node get added to the table
core.registered_nodes.
If you want to check the drawtype of a node, you could do:
local function get_nodedef_field(nodename, fieldname)
if not core.registered_nodes[nodename] then
return nil
end
return core.registered_nodes[nodename][fieldname]
end
local drawtype = get_nodedef_field(nodename, "drawtype")