fix(turtle-utils): getItemName and compactInventory

This commit is contained in:
Guillaume ARM 2024-05-19 19:48:46 +02:00
parent f76877b0ab
commit 70854f7a75

View File

@ -14,7 +14,7 @@ turtleUtils.getInventory = function(side)
end end
turtleUtils.getItemName = function(slotIndex) turtleUtils.getItemName = function(slotIndex)
local item = turtle.getItemDetail(i) local item = turtle.getItemDetail(slotIndex)
return item and item.name return item and item.name
end end
@ -254,7 +254,7 @@ end
-- Compact the internal turtle inventory (return the number of freed slots) -- Compact the internal turtle inventory (return the number of freed slots)
turtleUtils.compactInventory = function() turtleUtils.compactInventory = function()
local initialNbFreeSlots = turtle.countFreeSlots() local initialNbFreeSlots = turtleUtils.countFreeSlots()
local initialSelectedSlot = turtle.getSelectedSlot() local initialSelectedSlot = turtle.getSelectedSlot()
local itemsMap = getItemsMap() local itemsMap = getItemsMap()
@ -268,7 +268,7 @@ turtleUtils.compactInventory = function()
turtle.select(initialSelectedSlot) turtle.select(initialSelectedSlot)
end end
return turtle.countFreeSlots() - initialNbFreeSlots return turtleUtils.countFreeSlots() - initialNbFreeSlots
end end
return turtleUtils return turtleUtils