summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-01-19 14:00:49 -0500
committerShadowNinja <shadowninja@minetest.net>2014-01-19 14:00:49 -0500
commit34fe44356d9b0a7c93d6222e8c7a6de3a8b7e23a (patch)
tree80769d9bc5a69b99b04c632c52132702954e2a09
parent26473a83465a827716cf52f65a473a082f1d9b5b (diff)
Remove unnecessary recipe table copying
-rw-r--r--api.lua11
1 files changed, 4 insertions, 7 deletions
diff --git a/api.lua b/api.lua
index c5ec877..03705e6 100644
--- a/api.lua
+++ b/api.lua
@@ -8,19 +8,16 @@ minetest.after(0.01, function()
def.description and def.description ~= "" then
table.insert(unified_inventory.items_list, name)
local recipes = minetest.get_all_craft_recipes(name)
- if unified_inventory.crafts_table[name] == nil then
- unified_inventory.crafts_table[name] = {}
- end
if recipes then
- for i=1,#recipes,1 do
- table.insert(unified_inventory.crafts_table[name],recipes[i])
- end
+ unified_inventory.crafts_table[name] = recipes
+ else
+ unified_inventory.crafts_table[name] = {}
end
end
end
table.sort(unified_inventory.items_list)
unified_inventory.items_list_size = #unified_inventory.items_list
- print("Unified Inventory. inventory size: "..#unified_inventory.items_list)
+ print("Unified Inventory. inventory size: "..unified_inventory.items_list_size)
end)