diff options
Diffstat (limited to 'runtime/lua')
-rw-r--r-- | runtime/lua/man.lua | 3 | ||||
-rw-r--r-- | runtime/lua/vim/compat.lua | 12 |
2 files changed, 14 insertions, 1 deletions
diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua index 0c67e45dc4..e9f60138f4 100644 --- a/runtime/lua/man.lua +++ b/runtime/lua/man.lua @@ -1,5 +1,6 @@ +require('vim.compat') + local buf_hls = {} -local unpack = table.unpack or unpack -- luacheck: ignore local function highlight_line(line, linenr) local chars = {} diff --git a/runtime/lua/vim/compat.lua b/runtime/lua/vim/compat.lua new file mode 100644 index 0000000000..168979bb95 --- /dev/null +++ b/runtime/lua/vim/compat.lua @@ -0,0 +1,12 @@ +-- Lua 5.1 forward-compatibility layer. +-- For background see https://github.com/neovim/neovim/pull/9280 +-- +-- Reference the lua-compat-5.2 project for hints: +-- https://github.com/keplerproject/lua-compat-5.2/blob/c164c8f339b95451b572d6b4b4d11e944dc7169d/compat52/mstrict.lua +-- https://github.com/keplerproject/lua-compat-5.2/blob/c164c8f339b95451b572d6b4b4d11e944dc7169d/tests/test.lua + +local lua_version = _VERSION:sub(-3) + +if lua_version >= "5.2" then + unpack = table.unpack -- luacheck: ignore 121 143 +end |