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?
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?
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
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Ok, thanks. I just used the "Part1 =" thing for other people to easily edit. :P
You can put Part1/Whatever in each table for identification purposes.