Add example for gears.table.count_keys
Signed-off-by: Lucas Schwiderski <lucas@lschwiderski.de>
This commit is contained in:
parent
058190a3c0
commit
afced71a9a
|
@ -169,6 +169,8 @@ end
|
||||||
--
|
--
|
||||||
-- This is functionally equivalent, but faster than `#gears.table.keys(t)`.
|
-- This is functionally equivalent, but faster than `#gears.table.keys(t)`.
|
||||||
--
|
--
|
||||||
|
-- @DOC_text_gears_table_count_keys_EXAMPLE@
|
||||||
|
--
|
||||||
-- @tparam table t The table for which to count the keys.
|
-- @tparam table t The table for which to count the keys.
|
||||||
-- @treturn number The number of keys in the table.
|
-- @treturn number The number of keys in the table.
|
||||||
-- @staticfct gears.table.count_keys
|
-- @staticfct gears.table.count_keys
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
--DOC_GEN_OUTPUT --DOC_HIDE
|
||||||
|
local gears = require("gears") --DOC_HIDE
|
||||||
|
|
||||||
|
local tab = { 1, nil, "a", "b", foo = "bar" }
|
||||||
|
local count = gears.table.count_keys(tab)
|
||||||
|
print("The table has " .. count .. " keys")
|
Loading…
Reference in New Issue