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/typval.h | |
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/typval.h')
-rw-r--r-- | src/nvim/eval/typval.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h index cb13bec50d..503a32a81e 100644 --- a/src/nvim/eval/typval.h +++ b/src/nvim/eval/typval.h @@ -180,6 +180,8 @@ struct listvar_S { int lv_idx; ///< Index of a cached item, used for optimising repeated l[idx]. int lv_copyID; ///< ID used by deepcopy(). VarLockStatus lv_lock; ///< Zero, VAR_LOCKED, VAR_FIXED. + + LuaRef lua_table_ref; }; // Static list with 10 items. Use tv_list_init_static10() to initialize. @@ -245,6 +247,8 @@ struct dictvar_S { dict_T *dv_used_next; ///< Next dictionary in used dictionaries list. dict_T *dv_used_prev; ///< Previous dictionary in used dictionaries list. QUEUE watchers; ///< Dictionary key watchers set by user code. + + LuaRef lua_table_ref; }; /// Type used for script ID @@ -271,9 +275,10 @@ typedef struct { /// Number of fixed variables used for arguments #define FIXVAR_CNT 12 -/// Callback interface for C function reference +/// Callback interface for C function reference> +/// Used for managing functions that were registered with |register_cfunc| typedef int (*cfunc_T)(int argcount, typval_T *argvars, typval_T *rettv, void *state); // NOLINT -/// Callback to clear cfunc_T +/// Callback to clear cfunc_T and any associated state. typedef void (*cfunc_free_T)(void *state); // Structure to hold info for a function that is currently being executed. |