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

Issue regarding tables

I am having an issue regarding tables. I have a table like:

local Table = { Part1 = {true, false}, Part2 = {false, false}}
print(#Table)

It prints 0, any way I can fix that, do I need to just make them tables without the "PartX"'s?

1 answer

✓ Accepted answer

The #table syntax only works on tables with numerical keys. You don't need to assign a key to those values, since they are redundant.

Just make them numerical keys, like so:

Parts = {
	{true, false},
	{false, false}
}
print(#Parts)
-->> 2

2 comments

0

Ok, thanks. I just used the "Part1 =" thing for other people to easily edit. :P

0

You can put Part1/Whatever in each table for identification purposes.

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