diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-08-29 17:34:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-29 17:34:00 +0200 |
commit | 4e66e74fd7c6afb1813c40dd59f17091e546789d (patch) | |
tree | b4393cacfd5bfc8a4ebf3b1ba166eec83a8a9d9a /runtime/lua/vim | |
parent | 81f4de08bdfeb4b9c107e2eaff3cbb597b2df943 (diff) | |
parent | 6896d22b63ad12de4c4990d0eece4a9b6f9cd88f (diff) | |
download | rneovim-4e66e74fd7c6afb1813c40dd59f17091e546789d.tar.gz rneovim-4e66e74fd7c6afb1813c40dd59f17091e546789d.tar.bz2 rneovim-4e66e74fd7c6afb1813c40dd59f17091e546789d.zip |
Merge pull request #15304 from bfredl/quantumtheory
fix(lua): preserve argument list ... which has not the same length as #{...}
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r-- | runtime/lua/vim/F.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/lua/vim/F.lua b/runtime/lua/vim/F.lua index 09467eb8c6..1a258546a5 100644 --- a/runtime/lua/vim/F.lua +++ b/runtime/lua/vim/F.lua @@ -27,5 +27,14 @@ function F.nil_wrap(fn) end end +--- like {...} except preserve the lenght explicitly +function F.pack_len(...) + return {n=select('#', ...), ...} +end + +--- like unpack() but use the length set by F.pack_len if present +function F.unpack_len(t) + return unpack(t, 1, t.n) +end return F |