ghostbuster91 / nvim-next

Apache License 2.0
29 stars 6 forks source link

Fix: use `unpack()` instead of `table.unpack` #15

Closed ofseed closed 1 year ago

ofseed commented 1 year ago

I'm curious about why you can run this code in neovim, actually table.unpack is added in Lua 5.2, which is not supported by LuaJIT(support Lua 5.1 only), and LuaJIT is the official Lua interpreter of neovim.

ghostbuster91 commented 1 year ago

I'm curious about why you can run this code in neovim, actually table.unpack is added in Lua 5.2, which is not supported by LuaJIT(support Lua 5.1 only), and LuaJIT is the official Lua interpreter of neovim.

Hi, tbh I don't know. I have nvim installed via nix. Maybe the nix wrapper does some additional magic? But I doubt that it would change the LuaJIT version.

$ nvim --version                                                                                                      15:00:43
NVIM v0.9.2
Build type: Release
LuaJIT 2.1.1693350652

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "
/nix/store/1b4pbg130cdq5pjyi7vxqqrf7nqh63a5-neovim-unwrapped-0.9.2/share/nvim
"

Edit: There is a enable52Compat (that enables DLUAJIT_ENABLE_LUA52COMPAT) option but it seems to be turned off (to be verified, https://github.com/search?q=repo%3ANixOS%2Fnixpkgs%20enable52Compat&type=code)

ghostbuster91 commented 1 year ago

Your version works as well for me, and you are generally right about table.unpack being available in 5.2

Thanks for the fix :+1: