fix(health, rockspec): accept Lua 5.1+ for luarocks compatibility

Previously, lazy.nvim health checks required exactly Lua 5.1, causing
warnings on systems with newer Lua versions (5.2, 5.3, 5.4). This was
unnecessarily restrictive since LuaRocks can run on any Lua version 5.1+
to build packages.

Its true that Neovim plugins must be Lua 5.1 compatible (due to LuaJIT),
but the `--lua-version 5.1` flag tells luarocks to build for 5.1.

After some light testing, I verified a system with Lua 5.4 should be
able to build Lua 5.1-compatible packages just fine.

The key point is that this removes false warnings while maintaining the
same safety guarantees - LuaRocks with any modern Lua version can still
build packages targeting Lua 5.1 compatibility for Neovim.

Closes: #2020
This commit is contained in:
Spencer Gray 2025-07-14 16:17:30 -04:00
commit 17732094c8
2 changed files with 4 additions and 4 deletions

View file

@ -43,7 +43,7 @@ function M.have(cmd, opts)
else
local version = vim.trim(out[1] or "")
version = version:gsub("^%s*" .. vim.pesc(c) .. "%s*", "")
if opts.version_pattern and not version:find(opts.version_pattern, 1, true) then
if opts.version_pattern and not version:find(opts.version_pattern) then
opts.warn(("`%s` version `%s` needed, but found `%s`"):format(c, opts.version_pattern, version))
else
found = ("{%s} `%s`"):format(c, version)
@ -59,7 +59,7 @@ function M.have(cmd, opts)
(opts.optional and opts.warn or opts.error)(
("{%s} %snot installed"):format(
table.concat(cmd, "} or {"),
opts.version_pattern and "version `" .. opts.version_pattern .. "` " or ""
opts.version_pattern and "version matching `" .. opts.version_pattern .. "` " or ""
)
)
end