Why isn’t this working? This has kind of got me head-scratching…
local TestDict= {
["Test"] = {
1,2,3
},
["Test2"] = {
1,2,3
},
}
print(#TestDict) -- get length of table (number of indices)
--> Prints: 0
It’s just a dictionary with a bunch of numbers in it. None of my other tables / dictionaries cause an issue when attempting to read them. Even when I do this exact thing. It’s just a table with tables in it…
Honestly, I’m not sure of the reason myself. I just know that it doesn’t count the tables inside of the table, but if you were to also have a normal value like this:
it should print out 3. Also, as far as I know, it’s like this in every language, but a bit different. For JavaScript, {} is an Object and [] is an array. Arrays have a .length property, but an Object doesn’t and you need to get the number of keys instead.