Spoiler
function getFormattedBlockInfos( x, y, z, x2, y2, z2 )
local tBlockInfos = commands.getBlockInfos( x, y, z, x2, y2, z2 )
local tFormattedBlockInfos = {}
local iTablePosition = 1
--find the minimum and maximum verticies
local minx, miny, minz = math.min( x, x2 ), math.min( y, y2 ), math.min( z, z2 )
local maxx, maxy, maxz = math.max( x, x2 ), math.max( y, y2 ), math.max( z, z2 )
for iy = miny, maxy do
for iz = minz, maxz do
for ix = minx, maxx do
tFormattedBlockInfos[ ix ] = tFormattedBlockInfos[ ix ] or {}
tFormattedBlockInfos[ ix ][ iy ] = tFormattedBlockInfos[ ix ][ iy ] or {}
tFormattedBlockInfos[ ix ][ iy ][ iz ] = tBlockInfos[ iTablePosition ]
iTablePosition = iTablePosition + 1
end
end
end
print( #tBlockInfos )
print( iTablePosition )
print( #tFormattedBlockInfos )
return tFormattedBlockInfos
end
This amazing code, designed to convert the data from getBlockInfos into a table indexed by the coordinates, is not working. tBlockInfos is bigger than iTablePosition when printed, meaning it is not scanning the entire table. In addition, the size of tFormattedBlockInfos is 0, which I find very weird, since iTablePosition is a very high number.