Trouble with for i,v in pairs

Main problem: it loops through all X(the outer one) but only loop the first key of the tables inside.

Im trying to loop through every single tables below but it seem can’t to work.
image

image
This is my current code and yTab is suppose to be the tables Im trying to get.
Im thinking it might be to do with something with the alternative keys I have.

Yeah, I think the irregular numbering is making it be treated more as a dictionary rather than a table. If you just get rid of the ipairs keywords, does it work better?

i.e.

for x, xTab in grids[name] do
	print(x)
	for y, yTab in xTab do
		print(yTab)
	end
end

I agree with your conclusion. However, you do not need to use pairs either. Roblox released generalized iteration a while back which can help improve readability and eliminate these awkward scenarios

Yeah, that’s why I didn’t suggest the use of pairs instead.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.