'b', 'c' })
end, { predicate = true })
-- true
<
Parameters: ~
• {t} (`table`) Table to check
• {value} (`any`) Value to compare or predicate function reference
• {opts} (`table?`) Keyword arguments |kwargs|:
• {predicate}? (`boolean`) `value` is a function reference to
be checked (default false)
Return: ~
(`boolean`) `true` if `t` contains `value`
See also: ~
• |vim.list_contains()| for checking values in list-like tables
vim.tbl_count({t}) *vim.tbl_count()*
Counts the number of non-nil values in table `t`. >lua
vim.tbl_count({ a=1, b=2 }) --> 2
vim.tbl_count({ 1, 2 }) --> 2
<
Parameters: ~
• {t} (`table`) Table
Return: ~
(`integer`) Number of non-nil values in table
See also: ~
• https://github.com/Tieske/Penlight/blob/master/lua/pl/tablex.lua
vim.tbl_deep_extend({behavior}, {...}) *vim.tbl_deep_extend()*
Merges recursively two or more tables.
Only values that are empty tables or tables that are not |lua-list|s
(indexed by consecutive integers starting from 1) are merged recursively.
This is useful for merging nested tables like default and user
configurations where lists should be treated as literals (i.e., are
overwritten instead of merged).
Parameters: ~
• {behavior} (`'error'|'keep'|'force'|fun(key:any, prev_value:any?, value:any): any`)
Decides what to do if a key is found in more than one map:
• "error": raise an error
• "keep": use value from the leftmost map
• "force": use value from the rightmost map
• If a function, it receives the current key, the previous
value in the currently merged table (if present), the
current value and should return the value for the given
key in the merged table.
• {...} (`table`) Two or more tables
Return: ~
(`table`) Merged table
See also: ~
• |vim.tbl_extend()|
vim.tbl_extend({behavior}, {...}) *vim.tbl_extend()*
Merges two or more tables.
Parameters: ~
• {behavior} (`'error'|'keep'|'force'|fun(key:any, prev_value:any?, value:any): any`)
Decides what to do if a key is found in more than one map:
• "error": raise an error
• "keep": use value from the leftmost map
• "force": use value from the rightmost map
• If a function, it receives the current key, the previous
value in the currently merged table (if present), the
current value and should return the value for the given
key in the merged table.
• {...} (`table`) Two or more tables
Return: ~
(`table`) Merged table
See also: ~
• |extend()|
vim.tbl_filter({func}, {t}) *vim.tbl_filter()*
Filter a table using a predicate function
Parameters: ~
• {func} (`function`) Function
• {t} (`table`) Table
Return: ~
(`any[]`) Table of filtered values
vim.tbl_get({o}, {...}) *vim.tbl_get()*
Index into a table (first argument) via string keys passed as subsequent
arguments. Return `nil` if the key does not exist.
Examples: >lua
vim.tbl_get({ key = { nested_key = true }}, 'key', 'nested_key') == true
vim.tbl_get({ key = {}}, 'key', 'nested_key') == nil
<
Parameters: ~
• {o} (`table`) Table to index
• {...} (`any`) Optional keys (0 or more, variadic) via which to index
the table
Return: ~
(`any`) Nested value indexed by key (if it exists), else nil
vim.tbl_isempty({t})