Getting semi-table from index returns nil

once i try to get a table that is inside another table by its index, it doesn’t work, but when i do that by its name, it does work, is there a reason for that ?

here is the output

here is the code
image

1 Like

Dictionaries don’t have indices, arrays do. Values of dictionaries are accessed via their associated keys, values of arrays are accessed via their associated indices.

1 Like

so i can’t get a value directly by using a number ?

1 Like

Not from tables values which are structured as dictionaries.

1 Like
local table1 = {342, 44, 3333, 454} --array
local table2 = {["Hello"] = true, ["world!"] = false} --dictionary
print(table1[1]) --displays 342
print(table2[1]) --error
print(table2["Hello"]) --displays true
1 Like

i see, i will find a way around this, thanks for the answer

1 Like