diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2019-06-15 15:59:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-15 15:59:45 +0200 |
commit | 2f1a653a845680efab1a27f6411e36e8cd2f3696 (patch) | |
tree | fa562d5f83dbeb611d91cdf780bc1ce1e75a4408 /src/nvim/lua/executor.c | |
parent | 93f8c2793cf5020d6fca00b6f10e4a158578034f (diff) | |
parent | 64cdf9f78a9bfd4d08a9d9bf2df48a4b2f296190 (diff) | |
download | rneovim-2f1a653a845680efab1a27f6411e36e8cd2f3696.tar.gz rneovim-2f1a653a845680efab1a27f6411e36e8cd2f3696.tar.bz2 rneovim-2f1a653a845680efab1a27f6411e36e8cd2f3696.zip |
Merge pull request #10231 from bfredl/bufcb_end
api/lua: add on_detach to nvim_buf_attach
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r-- | src/nvim/lua/executor.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 8cb282356a..ae872c1540 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -520,7 +520,8 @@ Object executor_exec_lua_api(const String str, const Array args, Error *err) return nlua_pop_Object(lstate, false, err); } -Object executor_exec_lua_cb(LuaRef ref, const char *name, Array args) +Object executor_exec_lua_cb(LuaRef ref, const char *name, Array args, + bool retval) { lua_State *const lstate = nlua_enter(); nlua_pushref(lstate, ref); @@ -529,7 +530,7 @@ Object executor_exec_lua_cb(LuaRef ref, const char *name, Array args) nlua_push_Object(lstate, args.items[i]); } - if (lua_pcall(lstate, (int)args.size+1, 1, 0)) { + if (lua_pcall(lstate, (int)args.size+1, retval ? 1 : 0, 0)) { // TODO(bfredl): callbacks:s might not always be msg-safe, for instance // lua callbacks for redraw events. Later on let the caller deal with the // error instead. @@ -538,7 +539,11 @@ Object executor_exec_lua_cb(LuaRef ref, const char *name, Array args) } Error err = ERROR_INIT; - return nlua_pop_Object(lstate, false, &err); + if (retval) { + return nlua_pop_Object(lstate, false, &err); + } else { + return NIL; + } } /// Run lua string |