1
0
forked from aniani/vim

patch 8.2.1054: not so easy to pass a lua function to Vim

Problem:    Not so easy to pass a lua function to Vim.
Solution:   Convert a Lua function and closure to a Vim funcref. (Prabir
            Shrestha, closes #6246)
This commit is contained in:
Bram Moolenaar
2020-06-25 19:27:56 +02:00
parent 832adf9bb8
commit 801ab06934
7 changed files with 213 additions and 1 deletions

View File

@@ -333,6 +333,14 @@ Examples:
:lua l = d.len -- assign d as 'self'
:lua print(l())
<
Lua functions and closures are automatically converted to a Vim |Funcref| and
can be accessed in Vim scripts. Example:
>
lua <<EOF
vim.fn.timer_start(1000, function(timer)
print('timer callback')
end)
EOF
==============================================================================
7. Buffer userdata *lua-buffer*