hopefully fixed

This commit is contained in:
Justus Wolff
2026-02-22 20:23:39 +01:00
parent 6f6e61b092
commit f804467e82

View File

@@ -638,26 +638,31 @@ local function VP_createstack(buf, dimensions)
end end
VP_optimizestack(tempbuf) VP_optimizestack(tempbuf)
if #tempbuf > 0 then out[posasstring(x,z)] = tempbuf end if #tempbuf > 0 then
out[posasstring(x,z)] = tempbuf
end end
end end
for i,v in pairs(out) do print("ok");read() end end
fout["stacks"] = out fout["stacks"] = out
return fout return fout
end end
local function VP_lengthofdict(target)
local out = 0
for _,v in pairs(target) do out = out + 1 end
return out
end
local function VP_splitstack(_stack, x) local function VP_splitstack(_stack, x)
local stack = _stack["stacks"] local stack = _stack["stacks"]
if #stack == 0 then
error("Internal error, splitstack received 0 stacks. There is nothing to split.")
end
local dimensions = _stack["dimensions"] local dimensions = _stack["dimensions"]
local sx = dimensions["sx"] local sx = dimensions["sx"]
local sz = dimensions["sz"] local sz = dimensions["sz"]
local height = _stack["height"] local height = _stack["height"]
local stacks = {} local stacks = {}
local unevenstack = {} local unevenstack = {}
local stackmod = math.fmod(#stack, x) local stackmod = math.fmod(VP_lengthofdict(stack), x)
local stackdiv = math.floor(#stack/x) local stackdiv = math.floor(VP_lengthofdict(stack)/x)
if stackmod ~= 0 then if stackmod ~= 0 then
for tempstackindex=0,stackmod,1 do for tempstackindex=0,stackmod,1 do