feat(lua): make sure require'bit' always works, even with PUC lua 5.1

This commit is contained in:
bfredl
2022-11-28 22:43:10 +01:00
parent 09b6a68c37
commit 799edca18a
9 changed files with 241 additions and 4 deletions

View File

@@ -33,6 +33,22 @@ Lua 5.1, not worry about forward-compatibility with future Lua versions. If
Nvim ever ships with Lua 5.4+, a Lua 5.1 compatibility shim will be provided
so that old plugins continue to work transparently.
*lua-luajit*
Neovim is built with luajit on platforms which support it, which provides
extra functionality. Lua code in |init.lua| and plugins can assume its presence
on installations on common platforms. For maximum compatibility with less
common platforms, availability can be checked using the `jit` global variable: >lua
if jit then
-- code for luajit
else
-- code for plain lua 5.1
end
<
*lua-bit*
In particular, the luajit "bit" extension module is _always_ available.
A fallback implementation is included when nvim is built with PUC lua 5.1,
and will be transparently used when `require("bit")` is invoked.
==============================================================================
LUA CONCEPTS AND IDIOMS *lua-concepts*

View File

@@ -167,6 +167,7 @@ The following new APIs or features were added.
• |vim.treesitter.language.add()| as a new replacement for
`vim.treesitter.language.require_language`.
• `require'bit'` is now always available |lua-bit|
==============================================================================
CHANGED FEATURES *news-changes*