WoW:API getn
Jump to navigation
Jump to search
From TableLibraryTutorial of lua-users.org.
table.getn(table)
This is used to determine the size of a table. The size of a table is discussed at the top of this page.
> = table.getn({1,2,3}) -- Lua will count the elements if no size is specified 3 > = table.getn({1,2,3; n=10}) -- note, n overrides counting the elements 10 > t = {1,2,3} > table.setn(t, 10) -- set our own size with setn() > = table.getn(t) 10 > = table.getn({1,2,3,nil,5,6}) -- sequence ends at element 3 due to nil value at 4 3