summaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-06-25 19:27:56 +0200
committerBram Moolenaar <Bram@vim.org>2020-06-25 19:27:56 +0200
commit801ab069341c8652680d63c174530fd4feb2911e (patch)
treeff8d365fe4c9ea1dbd5b5918b3a58568a77ec18e /runtime/doc
parent832adf9bb8cd39d8e982d8a35ed8a6d39b974494 (diff)
downloadvim-git-801ab069341c8652680d63c174530fd4feb2911e.tar.gz
patch 8.2.1054: not so easy to pass a lua function to Vimv8.2.1054
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)
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/if_lua.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/runtime/doc/if_lua.txt b/runtime/doc/if_lua.txt
index 63e227d30..170f861ff 100644
--- 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*