luau icon indicating copy to clipboard operation
luau copied to clipboard

"Cannot iterate over a table without indexer" when using generalised iteration

Open JohnnyMorganz opened this issue 3 years ago • 4 comments

local v = {
	["x"] = 1,
	["y"] = 2,
	["z"] = 3
}

-- Or, alternatively
-- local v = {
--	x = 1,
--	y = 2,
--	z = 3
-- }

for a, b in v do
	--  ^ TypeError: Cannot iterate over a table without indexer
end

JohnnyMorganz avatar Nov 13 '22 14:11 JohnnyMorganz

This is a really annoying bug. I keep encountering it in my projects.

Why does this happen? Is there a path towards resolving it anytime soon?

dphfox avatar Nov 07 '23 12:11 dphfox