Count Lua Table Fields: Length Operator, pairs and table.nums
The Lua # operator is intended for sequence-like tables with consecutive integer keys. It is not a general count of every field, especially when the table contains holes or string keys.
To count all entries whose value is not nil, iterate with pairs:
For { "a", "b", "c" }, #t is appropriate. For { name = "Ada", score = 10 }, use an explicit loop such as table.nums(t).