feat(turtle-utils): compactInventory now returnthe number of freed slots
This commit is contained in:
parent
8483ffc696
commit
f76877b0ab
@ -252,8 +252,9 @@ local function compactItem(itemName)
|
||||
end
|
||||
end
|
||||
|
||||
-- Compact the internal turtle inventory
|
||||
-- Compact the internal turtle inventory (return the number of freed slots)
|
||||
turtleUtils.compactInventory = function()
|
||||
local initialNbFreeSlots = turtle.countFreeSlots()
|
||||
local initialSelectedSlot = turtle.getSelectedSlot()
|
||||
local itemsMap = getItemsMap()
|
||||
|
||||
@ -266,6 +267,8 @@ turtleUtils.compactInventory = function()
|
||||
if initialSelectedSlot ~= turtle.getSelectedSlot() then
|
||||
turtle.select(initialSelectedSlot)
|
||||
end
|
||||
|
||||
return turtle.countFreeSlots() - initialNbFreeSlots
|
||||
end
|
||||
|
||||
return turtleUtils
|
||||
Loading…
Reference in New Issue
Block a user