From 70854f7a752ed45d805fe9fbce18d5e8a31b2568 Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Sun, 19 May 2024 19:48:46 +0200 Subject: [PATCH] fix(turtle-utils): getItemName and compactInventory --- libs/turtle-utils.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/turtle-utils.lua b/libs/turtle-utils.lua index 2af9561..e48db71 100644 --- a/libs/turtle-utils.lua +++ b/libs/turtle-utils.lua @@ -14,7 +14,7 @@ turtleUtils.getInventory = function(side) end turtleUtils.getItemName = function(slotIndex) - local item = turtle.getItemDetail(i) + local item = turtle.getItemDetail(slotIndex) return item and item.name end @@ -254,7 +254,7 @@ end -- Compact the internal turtle inventory (return the number of freed slots) turtleUtils.compactInventory = function() - local initialNbFreeSlots = turtle.countFreeSlots() + local initialNbFreeSlots = turtleUtils.countFreeSlots() local initialSelectedSlot = turtle.getSelectedSlot() local itemsMap = getItemsMap() @@ -268,7 +268,7 @@ turtleUtils.compactInventory = function() turtle.select(initialSelectedSlot) end - return turtle.countFreeSlots() - initialNbFreeSlots + return turtleUtils.countFreeSlots() - initialNbFreeSlots end return turtleUtils \ No newline at end of file