diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2020-01-01 21:03:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-01 21:03:08 +0100 |
commit | 8645d480bd469d6bffa828bf220de6afc324b43c (patch) | |
tree | 1e0ca0a7e1d0727f10d4348ab1b582145dd27029 /src/nvim/lua/executor.c | |
parent | a495d49012586696f2244a589a4d34770ad07d17 (diff) | |
parent | ea4127e9a7a624484f51c21e17f37c766da15da0 (diff) | |
download | rneovim-8645d480bd469d6bffa828bf220de6afc324b43c.tar.gz rneovim-8645d480bd469d6bffa828bf220de6afc324b43c.tar.bz2 rneovim-8645d480bd469d6bffa828bf220de6afc324b43c.zip |
Merge pull request #11470 from bfredl/emptytable
metatable for empty dict value
Diffstat (limited to 'src/nvim/lua/executor.c')
-rw-r--r-- | src/nvim/lua/executor.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 2cd6c0db66..242d4e18d1 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -324,6 +324,13 @@ static int nlua_state_init(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL nlua_nil_ref = nlua_ref(lstate, -1); lua_setfield(lstate, -2, "NIL"); + // vim._empty_dict_mt + lua_createtable(lstate, 0, 0); + lua_pushcfunction(lstate, &nlua_empty_dict_tostring); + lua_setfield(lstate, -2, "__tostring"); + nlua_empty_dict_ref = nlua_ref(lstate, -1); + lua_setfield(lstate, -2, "_empty_dict_mt"); + // internal vim._treesitter... API nlua_add_treesitter(lstate); @@ -665,6 +672,12 @@ static int nlua_nil_tostring(lua_State *lstate) return 1; } +static int nlua_empty_dict_tostring(lua_State *lstate) +{ + lua_pushstring(lstate, "vim.empty_dict()"); + return 1; +} + #ifdef WIN32 /// os.getenv: override os.getenv to maintain coherency. #9681 |