diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-02-22 22:38:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-22 22:38:21 +0100 |
commit | d422fc8274e757e95329e60b4e6daec59363ba19 (patch) | |
tree | ee038fd6f6dfd129998f711be31ab19a2c8f8b6a /src/nvim/lua | |
parent | 09b6a68c3700aa5d8ae26a62896b091572ae0a8d (diff) | |
parent | 799edca18a4ddcf8edcb63dd391219e01e187f0d (diff) | |
download | rneovim-d422fc8274e757e95329e60b4e6daec59363ba19.tar.gz rneovim-d422fc8274e757e95329e60b4e6daec59363ba19.tar.bz2 rneovim-d422fc8274e757e95329e60b4e6daec59363ba19.zip |
Merge pull request #21222 from bfredl/bitband
feat(lua): make sure require'bit' always works, even on PUC LUA 5.1
Diffstat (limited to 'src/nvim/lua')
-rw-r--r-- | src/nvim/lua/stdlib.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/lua/stdlib.c b/src/nvim/lua/stdlib.c index 5aeff4de98..d9682ff63d 100644 --- a/src/nvim/lua/stdlib.c +++ b/src/nvim/lua/stdlib.c @@ -11,6 +11,10 @@ #include <string.h> #include <sys/types.h> +#ifdef NVIM_VENDOR_BIT +# include "bit.h" +#endif + #include "auto/config.h" #include "cjson/lua_cjson.h" #include "mpack/lmpack.h" @@ -596,6 +600,13 @@ void nlua_state_add_stdlib(lua_State *const lstate, bool is_thread) // vim.json lua_cjson_new(lstate); lua_setfield(lstate, -2, "json"); + +#ifdef NVIM_VENDOR_BIT + // if building with puc lua, use internal fallback for require'bit' + int top = lua_gettop(lstate); + luaopen_bit(lstate); + lua_settop(lstate, top); +#endif } /// like luaL_error, but allow cleanup |