diff --git a/stackgroup.lua b/stackgroup.lua index 28eed90..d769e4e 100644 --- a/stackgroup.lua +++ b/stackgroup.lua @@ -20,7 +20,7 @@ function prototype:defragment(chests) -- Find largest non-full stack for i=top,bottom,-1 do local entry = self[i] - if entry:getStack(chests).availableCount() ~= 0 then + if entry:getStack(chests):availableCount() ~= 0 then top = i break else @@ -32,7 +32,7 @@ function prototype:defragment(chests) local topEntry = self[top] local bottomEntry = self[bottom] - local txCap = math.min(bottomEntry.count, topEntry:getStack(chests).availableCount()) + local txCap = math.min(bottomEntry.count, topEntry:getStack(chests):availableCount()) local tx = bottomEntry:getChest(chests):moveItemsTo(txCap, bottomEntry.slot, topEntry:getChest(chests), topEntry.slot) if tx ~= txCap then @@ -51,7 +51,7 @@ function prototype:defragment(chests) bottom = bottom + 1 end - if topEntry:getStack(chests).availableCount() == 0 then + if topEntry:getStack(chests):availableCount() == 0 then top = top - 1 resultGroup[#resultGroup + 1] = topEntry end