Mercurial > vim
diff runtime/doc/if_lua.txt @ 21006:ae185f35e256 v8.2.1054
patch 8.2.1054: not so easy to pass a lua function to Vim
Commit: https://github.com/vim/vim/commit/801ab069341c8652680d63c174530fd4feb2911e
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 25 19:27:56 2020 +0200
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 25 Jun 2020 19:30:21 +0200 |
parents | 74e3316c1d5a |
children | 08e284594211 |
line wrap: on
line diff
--- a/runtime/doc/if_lua.txt +++ b/runtime/doc/if_lua.txt @@ -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*