diff options
author | Shadman <13149513+shadmansaleh@users.noreply.github.com> | 2022-01-02 01:35:15 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-01 12:35:15 -0700 |
commit | 55c4393e9f80ac3e7233da889efce4f760e41664 (patch) | |
tree | 1488db2d6b08a1688d47de65a9bc457ff5edc1b8 /runtime/doc | |
parent | f86039de1e6583cbdb48a33d89c782ff65baf767 (diff) | |
download | rneovim-55c4393e9f80ac3e7233da889efce4f760e41664.tar.gz rneovim-55c4393e9f80ac3e7233da889efce4f760e41664.tar.bz2 rneovim-55c4393e9f80ac3e7233da889efce4f760e41664.zip |
feat(lua): add support for multiple optional types in vim.validate (#16864)
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/lua.txt | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 036454702b..eaa25f0961 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1656,16 +1656,25 @@ validate({opt}) *vim.validate()* => error('arg1: expected even number, got 3') < + If multiple types are valid they can be given as a list. > + + vim.validate{arg1={{'foo'}, {'table', 'string'}}, arg2={'foo', {'table', 'string'}}} + => NOP (success) + + vim.validate{arg1={1, {'string', table'}}} + => error('arg1: expected string|table, got number') +< + Parameters: ~ - {opt} Map of parameter names to validations. Each key is - a parameter name; each value is a tuple in one of - these forms: + {opt} table of parameter names to validations. Each key + is a parameter name; each value is a tuple in one + of these forms: 1. (arg_value, type_name, optional) • arg_value: argument value - • type_name: string type name, one of: ("table", - "t", "string", "s", "number", "n", "boolean", - "b", "function", "f", "nil", "thread", - "userdata") + • type_name: string|table type name, one of: + ("table", "t", "string", "s", "number", "n", + "boolean", "b", "function", "f", "nil", + "thread", "userdata") or list of them. • optional: (optional) boolean, if true, `nil` is valid |