aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/compat.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-12-20 18:32:54 +0100
committerGitHub <noreply@github.com>2018-12-20 18:32:54 +0100
commit87b40f7445dce4477d575ac74b63132bade60a47 (patch)
tree2d6fb7c7d1396b355cc8e84854519127e08e430b /runtime/lua/vim/compat.lua
parentccb005b9e0d509bbe595515e7e17b0e9713a2c19 (diff)
parent127b8569e63d57321fc4cd77b7e55781f1447365 (diff)
downloadrneovim-87b40f7445dce4477d575ac74b63132bade60a47.tar.gz
rneovim-87b40f7445dce4477d575ac74b63132bade60a47.tar.bz2
rneovim-87b40f7445dce4477d575ac74b63132bade60a47.zip
Merge #9280 'Lua 5.2+ compatbility'
Diffstat (limited to 'runtime/lua/vim/compat.lua')
-rw-r--r--runtime/lua/vim/compat.lua12
1 files changed, 12 insertions, 0 deletions
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