Home / Lua / Shared / table / count


Returns    number
Prototype    table.count(table table)
Description    Returns the number of entries in (table). Unlike the # operator, this counts non-sequential/numeric indexes.

Examples

local t = {"one", "two"}
table.insert(t, "three")
t.apple = "four"
print(#t) -- 3
print(table.count(t)) -- 4