local Foods = { Salt = {Taste = "Salty", Hunger = "1"}, Cookie = {Taste = "Sweet", Hunger = "100"} } print(#Foods) --- Output = 0
I dont know why this happen. Why they cant recognize the length?
Dictionaries don't really exist in Lua. There's only tables.
Anyway, there are no values in your tables. You only assigned values within your table. If you do want to check how many keys and all are in your table, you must use a for loop and count how many entries there are.
local Foods = { Salt = 1, Cookie = 2 } print(#Foods) --- Output = 0 local entriesNumber = 0 for i, _ in pairs(Foods) do entriesNumber = entriesNumber + 1 end print(entriesNumber) -- Output = 2