aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/executor.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-02-28 00:07:31 +0100
committerGitHub <noreply@github.com>2022-02-28 00:07:31 +0100
commitfad33b095fcc2607ea9f058b5fa76cda9483a24e (patch)
tree8d453a80320e49c2748f03240db8a4338384c9a1 /src/nvim/lua/executor.c
parent1b5767aa3480c0cdc43f7a4b78f36a14e85a182f (diff)
parent991e472881bf29805982b402c1a010cde051ded3 (diff)
downloadrneovim-fad33b095fcc2607ea9f058b5fa76cda9483a24e.tar.gz
rneovim-fad33b095fcc2607ea9f058b5fa76cda9483a24e.tar.bz2
rneovim-fad33b095fcc2607ea9f058b5fa76cda9483a24e.zip
Merge pull request #14661 from tjdevries/tjdevries/lua_autocmd_v2
lua: autocmds take 2: electric autoroo
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r--src/nvim/lua/executor.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index 3c1676581c..18abf04ff6 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -1350,6 +1350,16 @@ Object nlua_exec(const String str, const Array args, Error *err)
return nlua_pop_Object(lstate, false, err);
}
+bool nlua_ref_is_function(LuaRef ref)
+{
+ lua_State *const lstate = global_lstate;
+ nlua_pushref(lstate, ref);
+ bool is_function = (lua_type(lstate, -1) == LUA_TFUNCTION);
+ lua_pop(lstate, 1);
+
+ return is_function;
+}
+
/// call a LuaRef as a function (or table with __call metamethod)
///
/// @param ref the reference to call (not consumed)