Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why my loop dont print all thing in my table?

I trying to print all thing in this table but it dont work.

local t = {
	["Hello"] = 2,
	["World"] = 3
}

for i = 1, #t do
	print(t[i])
end

1 answer

✓ Accepted answer

Use an generic loop to read table with key for index.

local t = {
	["Hello"] = 2,
	["World"] = 3
}

for i, v in next, t do
    print(i, v)
end

1 comment

1

Ohh is named "generic"

This discussion is preserved as it was. New answers, comments, and votes are closed.