From ee428d09bc4b85b03c76ca5aa5fe403159f711e7 Mon Sep 17 00:00:00 2001 From: Justus Wolff Date: Mon, 23 Feb 2026 01:00:43 +0100 Subject: [PATCH] check if even, yes? ok, add 1 no? dont add 1. --- src/main.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.lua b/src/main.lua index 532b911..3fbb3c0 100644 --- a/src/main.lua +++ b/src/main.lua @@ -891,7 +891,9 @@ while true do reset() print("Paired. Splitting stacks and sending out...") - stacks = VP_splitstack(stacks, #accepted+1) -- plus 1 because we also build as the master turtle. + local even = (VP_lengthofdict(stacks["stacks"])%(#accepted+1)) == 0 + if even then even = #accepted+1 else even = #accepted end + stacks = VP_splitstack(stacks, even) if #stacks["stacks"] ~= #accepted+1 then printError("Internal error with VP_splitstack. It returned "..#stacks["stacks"].." stacks.") return