From aff9d641c60881d9fbb2e86bb5426a38fa4f1a59 Mon Sep 17 00:00:00 2001 From: Michael Savage Date: Tue, 12 Dec 2023 00:29:39 +0200 Subject: Don't use floats to parse the Lua version (#1552) --- src/luarocks/deps.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index 2b8795ad..6f8990d7 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua @@ -652,10 +652,8 @@ function deps.scan_deps(results, manifest, name, version, deps_mode) end local function lua_h_exists(d, luaver) - local n = tonumber(luaver) - local major = math.floor(n) - local minor = (n - major) * 10 - local luanum = math.floor(major * 100 + minor) + local major, minor = luaver:match("(%d+)%.(%d+)") + local luanum = ("%s%02d"):format(major, tonumber(minor)) local lua_h = dir.path(d, "lua.h") local fd = io.open(lua_h) -- cgit v1.2.3-55-g6feb