vim.F
Methods6
function M.if_nil<T>(...: T) -> T
Deprecated
Returns the first argument which is not nil.
If all arguments are nil, returns nil.
Examples:
local a = nil
local b = nil
local c = 42
local d = true
assert(vim.F.if_nil(a, b, c, d) == 42)
Deprecated
function M.ok_or_nil(status, ...) -> ...unknown | nil
Deprecated
Use in combination with pcall
Deprecated
function M.npcall<T>(fn: fun(...) -> T, ...: T | nil) -> T
Deprecated
Nil pcall.
Deprecated
function M.nil_wrap(fn) -> fun(...) -> unknown
Deprecated
Wrap a function to return nil if it fails, otherwise the value
Deprecated
function M.pack_len(...) -> table
like {...} except preserve the length explicitly
function M.unpack_len(t) -> any
like unpack() but use the length set by F.pack_len if present