Your answers will definitely work, but they are too rigid for my needs. I think this problem is too complex to explain simply.
We have an array of 16 with the letters o and l distributed randomly but with a 9/10 chance to be a o and 1/10 to be a l
This is the array we itterate over
{"o","o","o","o","o","l","o","o","o","o","o","o","l","o","o","o"}
Starting at place 1, it checks that it is not “v”, seeing it is a “o”, it saves it and calls a function to get the length of “o” in a row, in this case 5
another function has the task of changing all the “o” s to “v” s, it does so for
{"v","v","v","v","v","l","o","o","o","o","o","o","l","o","o","o"}
then we want to input this array into the itterator, so that place two, which now is a “v” wont get selected and go through the round again with a length of 4 (as it starts at place 2) and set the “v” s back to “v” s
This is where the aforementioned problem is. I get the array that has correctly placed “v” s and need to put it back into the itterator so that it will skip the places now “v”. instead of going through all the functions again for places 2,3,4,5, it will skip to place 6.
I know that I am not the greatest at explaining, so ask as many questions as you want!
If it helps to make it clear, here is the main function
I only explained above in context of a 1 dimensional array, but the actual code uses a 2 dimentional array, so that is why there is zsize and xsize.
game.ReplicatedStorage.GiveToRender.OnClientEvent:Connect(function(ToRender,BottomPosX,BottomPosZ,PartSize)
local count=0
local partsposition=1
for i,chunkcolumn in ipairs(ToRender) do
for o,chunk in ipairs(chunkcolumn) do
local unzippedchunk=http:JSONDecode(chunk)--Uncompresses compressed table for
for p,column in ipairs(unzippedchunk) do
for a,part in ipairs(column) do
if part=="v" then continue end
count+=1
if count%10==0 then task.wait() end
local zsize=getzsize(ToRender,i,o,p,a,part)
local xsize=getxsize(ToRender,i,o,p,a,part,zsize)
ToRender=updatemap(ToRender,i,o,p,a,xsize,zsize)--Attempting to change the arrays
chunkcolumn=ToRender[i]--Attempting to change the arrays
chunk=chunkcolumn[o]--Attempting to change the arrays
unzippedchunk=http:JSONDecode(chunk)
column=unzippedchunk[p]--Attempting to change the arrays
part=column[a]
makepart(partsposition,xsize,zsize,part,i,o,p,a,BottomPosX,BottomPosZ,PartSize)
partsposition+=1
end
end
end
end
print(count)
end)
All said above, works in context of this code, the only problem is that setting say, torender to the new array with “v” s does not update it.
It may be necessary to use a manual iterator via a while or repeat until loop, but I want to hear your input first.