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