diff options
author | TJ DeVries <devries.timothyj@gmail.com> | 2020-06-30 02:05:06 -0400 |
---|---|---|
committer | TJ DeVries <devries.timothyj@gmail.com> | 2020-07-10 20:23:12 -0400 |
commit | 6360cf7ce87407bd8a519b9a17f45b2148291904 (patch) | |
tree | 6f770f564307cb8a31f6ead427114267fcba3953 /src/nvim/eval/userfunc.c | |
parent | 971a191c4d772493535d55524b994fe385fae546 (diff) | |
download | rneovim-6360cf7ce87407bd8a519b9a17f45b2148291904.tar.gz rneovim-6360cf7ce87407bd8a519b9a17f45b2148291904.tar.bz2 rneovim-6360cf7ce87407bd8a519b9a17f45b2148291904.zip |
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.
Diffstat (limited to 'src/nvim/eval/userfunc.c')
-rw-r--r-- | src/nvim/eval/userfunc.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index ca2f4a32ca..229f0e8dde 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -3458,7 +3458,6 @@ char_u *register_cfunc(cfunc_T cb, cfunc_free_T cb_free, void *state) { char_u *name = get_lambda_name(); ufunc_T *fp = NULL; - int flags = FC_CFUNC; fp = xcalloc(1, offsetof(ufunc_T, uf_name) + STRLEN(name) + 1); if (fp == NULL) { @@ -3467,7 +3466,7 @@ char_u *register_cfunc(cfunc_T cb, cfunc_free_T cb_free, void *state) fp->uf_refcount = 1; fp->uf_varargs = true; - fp->uf_flags = flags; + fp->uf_flags = FC_CFUNC; fp->uf_calls = 0; fp->uf_script_ctx = current_sctx; fp->uf_cb = cb; @@ -3477,5 +3476,5 @@ char_u *register_cfunc(cfunc_T cb, cfunc_free_T cb_free, void *state) STRCPY(fp->uf_name, name); hash_add(&func_hashtab, UF2HIKEY(fp)); - return name; + return fp->uf_name; } |