summaryrefslogtreecommitdiff
path: root/nodes/node_duplicator.lua
diff options
context:
space:
mode:
authorJoe Julian <me@joejulian.name>2018-01-11 11:13:10 -0800
committerJoe Julian <me@joejulian.name>2018-01-11 11:13:10 -0800
commit564bc1179932f5c7b21bc56b4f7aa55e7f121abb (patch)
tree6b2610fd7fc81b742a250bac27329b4b9618914d /nodes/node_duplicator.lua
parent33995bc6ecf5b497f4e6b84b72fb476acf203af7 (diff)
Create missing tables
After a failure to move the digtron with its metadata, some nodes were broken. This worked around crashes that occurred if the inventory table was missing.
Diffstat (limited to 'nodes/node_duplicator.lua')
-rw-r--r--nodes/node_duplicator.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/nodes/node_duplicator.lua b/nodes/node_duplicator.lua
index 7d20a65..4533bae 100644
--- a/nodes/node_duplicator.lua
+++ b/nodes/node_duplicator.lua
@@ -146,6 +146,9 @@ minetest.register_node("digtron:duplicator", {
-- clear inventories of image's nodes
for _, node_image in pairs(layout.inventories) do
local main_inventory = node_image.meta.inventory.main
+ if type(main_inventory) ~= "table" then
+ main_inventory = {}
+ end
for index, _ in pairs(main_inventory) do
main_inventory[index] = ItemStack(nil)
end
@@ -175,4 +178,4 @@ minetest.register_node("digtron:duplicator", {
end
end,
-}) \ No newline at end of file
+})