Call as
Functions.collections.tablelength(T)
Record it as a dependency named Functions.collections.tablelength (accepting the completion does this), then call it by that name.
What it does
Count all entries visited by pairs, including false values and sparse numeric or nonnumeric keys. A nil table has length zero.
Arguments
| Name | Type | What it does |
|---|---|---|
T | table | nil | Table to count, or nil for zero. |
Returns
| 1 | number | Number of entries visited. |
|---|
Editions
Built In helpers are registered on every edition. What differs is the game API they read; where one is missing the helper falls back or returns nil with a reason.
It reads no game API directly.
Example
local dots = { Moonfire = true, Sunfire = true }
return Functions.collections.tablelength(dots) >= 2Source
Functions/collections.lua, line 89. Read only in game; Duplicate makes an editable copy.
Functions.collections.tablelength(T)
if T == nil then return 0 end
local count = 0
for _ in pairs(T) do count = count + 1 end
return count