From 1561654e0e708b88e49d955de9f538da8bd38702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Sterle?= Date: Mon, 22 Mar 2021 15:29:51 +0100 Subject: [PATCH] add note about nvim_call_function --- README.md | 2 ++ doc/nvim-lua-guide.txt | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 448fc0b..76c5dd6 100644 --- a/README.md +++ b/README.md @@ -724,6 +724,8 @@ vim.fn['my#autoload#function']() The functionality of `vim.fn` is identical to `vim.call`, but allows a more Lua-like syntax. +It is distinct from `vim.api.nvim_call_function` in that converting Vim/Lua objects is automatic: `vim.api.nvim_call_function` returns a table for floating point numbers and does not accept Lua closures while `vim.fn` handles these types transparently. + See also: - `:help vim.fn` diff --git a/doc/nvim-lua-guide.txt b/doc/nvim-lua-guide.txt index a4332a5..2a82708 100644 --- a/doc/nvim-lua-guide.txt +++ b/doc/nvim-lua-guide.txt @@ -881,6 +881,11 @@ Lua, so autoload functions have to be called with this syntax: The functionality of `vim.fn` is identical to `vim.call`, but allows a more Lua-like syntax. +It is distinct from `vim.api.nvim_call_function` in that converting +Vim/Lua objects is automatic: `vim.api.nvim_call_function` returns a +table for floating point numbers and does not accept Lua closures while +`vim.fn` handles these types transparently. + See also: - |vim.fn|