From 971a191c4d772493535d55524b994fe385fae546 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Fri, 19 Jun 2020 00:23:30 -0400 Subject: lua: Add ability to pass lua functions directly to vimL --- src/nvim/lua/converter.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/nvim/lua/converter.h') diff --git a/src/nvim/lua/converter.h b/src/nvim/lua/converter.h index 542c56ea3e..e74e3fb084 100644 --- a/src/nvim/lua/converter.h +++ b/src/nvim/lua/converter.h @@ -9,6 +9,14 @@ #include "nvim/func_attr.h" #include "nvim/eval.h" +typedef struct { + LuaRef func_ref; +} LuaCallable; + +typedef struct { + LuaCallable lua_callable; +} LuaCFunctionState; + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "lua/converter.h.generated.h" #endif -- cgit From 6360cf7ce87407bd8a519b9a17f45b2148291904 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Tue, 30 Jun 2020 02:05:06 -0400 Subject: lua: Add ability to pass tables with __call vim-patch:8.2.1054: not so easy to pass a lua function to Vim vim-patch:8.2.1084: Lua: registering function has useless code I think I have also opened up the possibility for people to use these callbacks elsewhere, since I've added a new struct that we should be able to use. Also, this should allow us to determine what the state of a list is in Lua or a dictionary in Lua, since we now can track the luaref as we go. --- src/nvim/lua/converter.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/nvim/lua/converter.h') diff --git a/src/nvim/lua/converter.h b/src/nvim/lua/converter.h index e74e3fb084..8601a32418 100644 --- a/src/nvim/lua/converter.h +++ b/src/nvim/lua/converter.h @@ -10,11 +10,12 @@ #include "nvim/eval.h" typedef struct { - LuaRef func_ref; + LuaRef func_ref; + LuaRef table_ref; } LuaCallable; typedef struct { - LuaCallable lua_callable; + LuaCallable lua_callable; } LuaCFunctionState; #ifdef INCLUDE_GENERATED_DECLARATIONS -- cgit