diff options
| author | Björn Linse <bjorn.linse@gmail.com> | 2019-10-27 19:49:30 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-27 19:49:30 +0100 |
| commit | e085cacba4e98e476da157616591c24d97b402c7 (patch) | |
| tree | 10d21767661d455e18a434c56714f745d8262b7f /src/nvim/lua/converter.c | |
| parent | 479c01412242c11eab8bdbe62048b1351731bea2 (diff) | |
| parent | 8ee7c94a92598d46b488b7fe3b1a5cff6b1bf94a (diff) | |
| download | rneovim-e085cacba4e98e476da157616591c24d97b402c7.tar.gz rneovim-e085cacba4e98e476da157616591c24d97b402c7.tar.bz2 rneovim-e085cacba4e98e476da157616591c24d97b402c7.zip | |
Merge pull request #11302 from bfredl/luacall
lua: add vim.fn.{func} for direct access to vimL function
Diffstat (limited to 'src/nvim/lua/converter.c')
| -rw-r--r-- | src/nvim/lua/converter.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/nvim/lua/converter.c b/src/nvim/lua/converter.c index 9665655e74..844232c64a 100644 --- a/src/nvim/lua/converter.c +++ b/src/nvim/lua/converter.c @@ -401,6 +401,8 @@ nlua_pop_typval_table_processing_end: return ret; } +static bool typval_conv_special = false; + #define TYPVAL_ENCODE_ALLOW_SPECIALS true #define TYPVAL_ENCODE_CONV_NIL(tv) \ @@ -439,7 +441,13 @@ nlua_pop_typval_table_processing_end: lua_createtable(lstate, 0, 0) #define TYPVAL_ENCODE_CONV_EMPTY_DICT(tv, dict) \ - nlua_create_typed_table(lstate, 0, 0, kObjectTypeDictionary) + do { \ + if (typval_conv_special) { \ + nlua_create_typed_table(lstate, 0, 0, kObjectTypeDictionary); \ + } else { \ + lua_createtable(lstate, 0, 0); \ + } \ + } while (0) #define TYPVAL_ENCODE_CONV_LIST_START(tv, len) \ do { \ @@ -548,9 +556,11 @@ nlua_pop_typval_table_processing_end: /// @param[in] tv typval_T to convert. /// /// @return true in case of success, false otherwise. -bool nlua_push_typval(lua_State *lstate, typval_T *const tv) +bool nlua_push_typval(lua_State *lstate, typval_T *const tv, bool special) { + typval_conv_special = special; const int initial_size = lua_gettop(lstate); + if (!lua_checkstack(lstate, initial_size + 2)) { emsgf(_("E1502: Lua failed to grow stack to %i"), initial_size + 4); return false; |
