From 89d997d6bb3f82c38e07878b498e60152dd1f0e7 Mon Sep 17 00:00:00 2001 From: Luke aka SwissalpS Date: Sun, 11 Jun 2023 03:16:33 +0200 Subject: [PATCH] hash can be reused since it is asigned to local var anyway, makes code more compact and easier to read --- autocrafter.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autocrafter.lua b/autocrafter.lua index 22ff6d7..6538aea 100644 --- a/autocrafter.lua +++ b/autocrafter.lua @@ -97,18 +97,18 @@ end -- note, that this function assumes allready being updated to virtual items -- and doesn't handle recipes with stacksizes > 1 local function after_recipe_change(pos, inventory) + local hash = minetest.hash_node_position(pos) local meta = minetest.get_meta(pos) -- if we emptied the grid, there's no point in keeping it running or cached if inventory:is_empty("recipe") then minetest.get_node_timer(pos):stop() - autocrafterCache[minetest.hash_node_position(pos)] = nil + autocrafterCache[hash] = nil meta:set_string("infotext", S("unconfigured Autocrafter")) inventory:set_stack("output", 1, "") return end - local recipe = inventory:get_list("recipe") - local hash = minetest.hash_node_position(pos) + local recipe = inventory:get_list("recipe") local craft = autocrafterCache[hash] if craft then