aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2024-02-17 15:46:01 -0300
committerHisham Muhammad <hisham@gobolinux.org>2024-02-18 20:49:05 -0300
commitd83b908a7371360d117cabbf6da099170f5fb178 (patch)
treef795b4f1e362da5d8204a6433ff7927888ada222 /src
parent4eee542ddcbde8df3bd64eee0bda87d6b96e0005 (diff)
downloadluarocks-d83b908a7371360d117cabbf6da099170f5fb178.tar.gz
luarocks-d83b908a7371360d117cabbf6da099170f5fb178.tar.bz2
luarocks-d83b908a7371360d117cabbf6da099170f5fb178.zip
drop cfg.lua_interpreter, use cfg.variables.LUA
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/cmd.lua68
-rw-r--r--src/luarocks/cmd/config.lua3
-rw-r--r--src/luarocks/cmd/init.lua14
-rw-r--r--src/luarocks/core/cfg.lua42
-rw-r--r--src/luarocks/fs/lua.lua2
-rw-r--r--src/luarocks/fs/unix.lua2
-rw-r--r--src/luarocks/fs/win32.lua2
-rw-r--r--src/luarocks/test/command.lua3
-rw-r--r--src/luarocks/util.lua30
9 files changed, 98 insertions, 68 deletions
diff --git a/src/luarocks/cmd.lua b/src/luarocks/cmd.lua
index 250e3cff..9c3d91db 100644
--- a/src/luarocks/cmd.lua
+++ b/src/luarocks/cmd.lua
@@ -184,7 +184,11 @@ local function die(message, exitcode)
184 os.exit(exitcode or cmd.errorcodes.UNSPECIFIED) 184 os.exit(exitcode or cmd.errorcodes.UNSPECIFIED)
185end 185end
186 186
187local function search_lua_in_path(lua_version, verbose) 187local function search_lua(lua_version, verbose, search_at)
188 if search_at then
189 return util.find_lua(search_at, lua_version, verbose)
190 end
191
188 local path_sep = (package.config:sub(1, 1) == "\\" and ";" or ":") 192 local path_sep = (package.config:sub(1, 1) == "\\" and ";" or ":")
189 local all_tried = {} 193 local all_tried = {}
190 for bindir in (os.getenv("PATH") or ""):gmatch("[^"..path_sep.."]+") do 194 for bindir in (os.getenv("PATH") or ""):gmatch("[^"..path_sep.."]+") do
@@ -284,7 +288,7 @@ do
284 end 288 end
285 289
286 if lua_version then 290 if lua_version then
287 local detected = search_lua_in_path(lua_version) 291 local detected = search_lua(lua_version)
288 if detected then 292 if detected then
289 return detected 293 return detected
290 end 294 end
@@ -497,6 +501,19 @@ Enabling completion for Fish:
497 return parser 501 return parser
498end 502end
499 503
504local function get_first_arg()
505 if not arg then
506 return
507 end
508 local first_arg = arg[0]
509 local i = -1
510 while arg[i] do
511 first_arg = arg[i]
512 i = i -1
513 end
514 return first_arg
515end
516
500--- Main command-line processor. 517--- Main command-line processor.
501-- Parses input arguments and calls the appropriate driver function 518-- Parses input arguments and calls the appropriate driver function
502-- to execute the action requested on the command-line, forwarding 519-- to execute the action requested on the command-line, forwarding
@@ -610,20 +627,47 @@ function cmd.run_command(description, commands, external_namespace, ...)
610 -- try again now. 627 -- try again now.
611 local tried 628 local tried
612 if not lua_found then 629 if not lua_found then
613 if cfg.variables.LUA_DIR then 630 local detected
614 lua_found, tried = util.find_lua(cfg.variables.LUA_DIR, cfg.lua_version, args.verbose) 631 detected, tried = search_lua(cfg.lua_version, args.verbose, cfg.variables.LUA_DIR)
615 else 632 if detected then
616 lua_found, tried = search_lua_in_path(cfg.lua_version, args.verbose) 633 lua_found = true
634 cfg.variables.LUA = detected.lua
635 cfg.variables.LUA_DIR = detected.lua_dir
636 cfg.variables.LUA_BINDIR = detected.lua_bindir
637 if args.lua_dir then
638 cfg.variables.LUA_INCDIR = nil
639 cfg.variables.LUA_LIBDIR = nil
640 end
617 end 641 end
618 end 642 end
619 643
620 if not lua_found and args.command ~= "config" and args.command ~= "help" then 644 if lua_found then
621 util.warning(tried .. 645 assert(cfg.variables.LUA)
622 "\nModules may not install with the correct configurations. " .. 646 else
623 "You may want to configure the path prefix to your build " .. 647 if args.command ~= "config" and args.command ~= "help" then
624 "of Lua " .. cfg.lua_version .. " using\n\n" .. 648 util.warning(tried ..
625 " luarocks config --local lua_dir <your-lua-prefix>\n") 649 "\nModules may not install with the correct configurations. " ..
650 "You may want to configure the path prefix to your build " ..
651 "of Lua " .. cfg.lua_version .. " using\n\n" ..
652 " luarocks config --local lua_dir <your-lua-prefix>\n")
653 end
654
655 -- Fallback producing _some_ Lua configuration based on the running interpreter.
656 -- Most likely won't produce correct results when running from the standalone binary,
657 -- so eventually we need to drop this and outright fail if Lua is not found
658 -- or explictly configured
659 if not cfg.variables.LUA then
660 local first_arg = get_first_arg()
661 cfg.variables.LUA_DIR = dir.dir_name(fs.absolute_name(first_arg))
662 cfg.variables.LUA_BINDIR = cfg.variables.LUA_DIR
663 local exe = fs.base_name(first_arg)
664 exe = exe:match("rocks") and ("lua" .. (cfg.arch:match("win") and ".exe" or "")) or exe
665 cfg.variables.LUA = dir.path(cfg.variables.LUA_BINDIR, exe)
666 cfg.variables.LUA_INCDIR = nil
667 cfg.variables.LUA_LIBDIR = nil
668 end
626 end 669 end
670
627 cfg.lua_found = lua_found 671 cfg.lua_found = lua_found
628 672
629 if cfg.project_dir then 673 if cfg.project_dir then
diff --git a/src/luarocks/cmd/config.lua b/src/luarocks/cmd/config.lua
index d9b679df..7ad28777 100644
--- a/src/luarocks/cmd/config.lua
+++ b/src/luarocks/cmd/config.lua
@@ -18,7 +18,6 @@ Query information about the LuaRocks configuration.
18 any command-line flags passed) 18 any command-line flags passed)
19 19
20 Examples: 20 Examples:
21 luarocks config lua_interpreter
22 luarocks config variables.LUA_INCDIR 21 luarocks config variables.LUA_INCDIR
23 luarocks config lua_version 22 luarocks config lua_version
24 23
@@ -300,7 +299,7 @@ function config_cmd.command(args)
300 ["variables.LUA_BINDIR"] = cfg.variables.LUA_BINDIR, 299 ["variables.LUA_BINDIR"] = cfg.variables.LUA_BINDIR,
301 ["variables.LUA_INCDIR"] = cfg.variables.LUA_INCDIR, 300 ["variables.LUA_INCDIR"] = cfg.variables.LUA_INCDIR,
302 ["variables.LUA_LIBDIR"] = cfg.variables.LUA_LIBDIR, 301 ["variables.LUA_LIBDIR"] = cfg.variables.LUA_LIBDIR,
303 ["lua_interpreter"] = cfg.lua_interpreter, 302 ["variables.LUA"] = cfg.variables.LUA,
304 } 303 }
305 if args.lua_version then 304 if args.lua_version then
306 local prefix = dir.dir_name(cfg.config_files[scope].file) 305 local prefix = dir.dir_name(cfg.config_files[scope].file)
diff --git a/src/luarocks/cmd/init.lua b/src/luarocks/cmd/init.lua
index efd612e4..543a720b 100644
--- a/src/luarocks/cmd/init.lua
+++ b/src/luarocks/cmd/init.lua
@@ -78,8 +78,7 @@ local function write_wrapper_scripts(wrapper_dir, luarocks_wrapper, lua_wrapper)
78 end 78 end
79 79
80 if write_lua_wrapper then 80 if write_lua_wrapper then
81 local interp = dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter) 81 if util.check_lua_version(cfg.variables.LUA, cfg.lua_version) then
82 if util.check_lua_version(interp, cfg.lua_version) then
83 util.printout("Preparing " .. lua_wrapper .. " for version " .. cfg.lua_version .. "...") 82 util.printout("Preparing " .. lua_wrapper .. " for version " .. cfg.lua_version .. "...")
84 path.use_tree(tree) 83 path.use_tree(tree)
85 fs.wrap_script(nil, lua_wrapper, "all") 84 fs.wrap_script(nil, lua_wrapper, "all")
@@ -160,21 +159,12 @@ function init.command(args)
160 159
161 local config_tbl, err = persist.load_config_file_if_basic(config_file, cfg) 160 local config_tbl, err = persist.load_config_file_if_basic(config_file, cfg)
162 if config_tbl then 161 if config_tbl then
163 local globals = {
164 "lua_interpreter",
165 }
166 for _, v in ipairs(globals) do
167 if cfg[v] then
168 config_tbl[v] = cfg[v]
169 end
170 end
171
172 local varnames = { 162 local varnames = {
173 "LUA_DIR", 163 "LUA_DIR",
174 "LUA_INCDIR", 164 "LUA_INCDIR",
175 "LUA_LIBDIR", 165 "LUA_LIBDIR",
176 "LUA_BINDIR", 166 "LUA_BINDIR",
177 "LUA_INTERPRETER", 167 "LUA",
178 } 168 }
179 for _, varname in ipairs(varnames) do 169 for _, varname in ipairs(varnames) do
180 if cfg.variables[varname] then 170 if cfg.variables[varname] then
diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua
index 81987cc9..2e5301c1 100644
--- a/src/luarocks/core/cfg.lua
+++ b/src/luarocks/core/cfg.lua
@@ -175,7 +175,6 @@ local function make_defaults(lua_version, target_cpu, platforms, home)
175 -- Configure defaults: 175 -- Configure defaults:
176 local defaults = { 176 local defaults = {
177 177
178 lua_interpreter = "lua",
179 local_by_default = false, 178 local_by_default = false,
180 accept_unknown_fields = false, 179 accept_unknown_fields = false,
181 fs_use_modules = true, 180 fs_use_modules = true,
@@ -556,19 +555,6 @@ local function use_defaults(cfg, defaults)
556 end 555 end
557end 556end
558 557
559local function get_first_arg()
560 if not arg then
561 return
562 end
563 local first_arg = arg[0]
564 local i = -1
565 while arg[i] do
566 first_arg = arg[i]
567 i = i -1
568 end
569 return first_arg
570end
571
572-------------------------------------------------------------------------------- 558--------------------------------------------------------------------------------
573 559
574local cfg = {} 560local cfg = {}
@@ -580,7 +566,7 @@ local cfg = {}
580-- * lua_version (in x.y format, e.g. "5.3") 566-- * lua_version (in x.y format, e.g. "5.3")
581-- * lua_bindir (e.g. "/usr/local/bin") 567-- * lua_bindir (e.g. "/usr/local/bin")
582-- * lua_dir (e.g. "/usr/local") 568-- * lua_dir (e.g. "/usr/local")
583-- * lua_interpreter (e.g. "lua-5.3") 569-- * lua (e.g. "/usr/local/bin/lua-5.3")
584-- * project_dir (a string with the path of the project directory 570-- * project_dir (a string with the path of the project directory
585-- when using per-project environments, as created with `luarocks init`) 571-- when using per-project environments, as created with `luarocks init`)
586-- @param warning a logging function for warnings that takes a string 572-- @param warning a logging function for warnings that takes a string
@@ -615,16 +601,15 @@ function cfg.init(detected, warning)
615 601
616 -- Use detected values as defaults, overridable via config files or CLI args 602 -- Use detected values as defaults, overridable via config files or CLI args
617 603
618 local first_arg = get_first_arg()
619
620 cfg.lua_version = detected.lua_version or hardcoded.LUA_VERSION or _VERSION:sub(5) 604 cfg.lua_version = detected.lua_version or hardcoded.LUA_VERSION or _VERSION:sub(5)
621 cfg.lua_interpreter = detected.lua_interpreter or hardcoded.LUA_INTERPRETER or (first_arg and first_arg:gsub(".*[\\/]", "")) or (is_windows and "lua.exe" or "lua")
622 cfg.project_dir = (not hardcoded.FORCE_CONFIG) and detected.project_dir 605 cfg.project_dir = (not hardcoded.FORCE_CONFIG) and detected.project_dir
623 606
624 do 607 do
625 local lua_bindir = detected.lua_bindir or hardcoded.LUA_BINDIR or (first_arg and first_arg:gsub("[\\/][^\\/]+$", "")) 608 local lua = detected.lua or hardcoded.LUA
626 local lua_dir = detected.lua_dir or hardcoded.LUA_DIR or (lua_bindir and lua_bindir:gsub("[\\/]bin$", "")) 609 local lua_bindir = detected.lua_bindir or hardcoded.LUA_BINDIR
610 local lua_dir = detected.lua_dir or hardcoded.LUA_DIR
627 cfg.variables = { 611 cfg.variables = {
612 LUA = lua,
628 LUA_DIR = lua_dir, 613 LUA_DIR = lua_dir,
629 LUA_BINDIR = lua_bindir, 614 LUA_BINDIR = lua_bindir,
630 LUA_LIBDIR = hardcoded.LUA_LIBDIR, 615 LUA_LIBDIR = hardcoded.LUA_LIBDIR,
@@ -756,6 +741,11 @@ function cfg.init(detected, warning)
756 end 741 end
757 end 742 end
758 743
744 -- backwards compatibility:
745 if cfg.lua_interpreter and cfg.variables.LUA_BINDIR and not cfg.variables.LUA then
746 cfg.variables.LUA = (cfg.variables.LUA_BINDIR .. "/" .. cfg.lua_interpreter):gsub("\\", "/")
747 end
748
759 ---------------------------------------- 749 ----------------------------------------
760 -- Config files are loaded. 750 -- Config files are loaded.
761 -- Let's finish up the cfg table. 751 -- Let's finish up the cfg table.
@@ -765,11 +755,11 @@ function cfg.init(detected, warning)
765 cfg.project_dir = detected.given_project_dir or cfg.project_dir 755 cfg.project_dir = detected.given_project_dir or cfg.project_dir
766 cfg.lua_version = detected.given_lua_version or cfg.lua_version 756 cfg.lua_version = detected.given_lua_version or cfg.lua_version
767 if detected.given_lua_dir then 757 if detected.given_lua_dir then
758 cfg.variables.LUA = detected.lua
768 cfg.variables.LUA_DIR = detected.given_lua_dir 759 cfg.variables.LUA_DIR = detected.given_lua_dir
769 cfg.variables.LUA_BINDIR = detected.lua_bindir 760 cfg.variables.LUA_BINDIR = detected.lua_bindir
770 cfg.variables.LUA_LIBDIR = nil 761 cfg.variables.LUA_LIBDIR = nil
771 cfg.variables.LUA_INCDIR = nil 762 cfg.variables.LUA_INCDIR = nil
772 cfg.lua_interpreter = detected.lua_interpreter
773 end 763 end
774 764
775 -- Build a default list of rocks trees if not given 765 -- Build a default list of rocks trees if not given
@@ -794,9 +784,17 @@ function cfg.init(detected, warning)
794 defaults.fs_use_modules = true 784 defaults.fs_use_modules = true
795 end 785 end
796 786
787 -- if only cfg.variables.LUA is given in config files,
788 -- derive LUA_BINDIR and LUA_DIR from them.
789 if cfg.variables.LUA and not cfg.variables.LUA_BINDIR then
790 cfg.variables.LUA_BINDIR = cfg.variables.LUA:gsub("^(.*)[/\\][^/\\]*$")
791 if not cfg.variables.LUA_DIR then
792 cfg.variables.LUA_DIR = cfg.variables.LUA_BINDIR:gsub("[/\\]bin$", "") or cfg.variables.LUA_BINDIR
793 end
794 end
795
797 use_defaults(cfg, defaults) 796 use_defaults(cfg, defaults)
798 797
799 cfg.variables.LUA = cfg.variables.LUA or (cfg.variables.LUA_BINDIR and (cfg.variables.LUA_BINDIR .. "/" .. cfg.lua_interpreter):gsub("//", "/"))
800 cfg.user_agent = "LuaRocks/"..cfg.program_version.." "..cfg.arch 798 cfg.user_agent = "LuaRocks/"..cfg.program_version.." "..cfg.arch
801 799
802 cfg.config_files = { 800 cfg.config_files = {
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua
index 0805efd2..e9b4c5d8 100644
--- a/src/luarocks/fs/lua.lua
+++ b/src/luarocks/fs/lua.lua
@@ -1188,7 +1188,7 @@ end
1188-- @return boolean true, if it is a Lua script, false otherwise 1188-- @return boolean true, if it is a Lua script, false otherwise
1189function fs_lua.is_lua(filename) 1189function fs_lua.is_lua(filename)
1190 filename = filename:gsub([[%\]],"/") -- normalize on fw slash to prevent escaping issues 1190 filename = filename:gsub([[%\]],"/") -- normalize on fw slash to prevent escaping issues
1191 local lua = fs.Q(dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)) -- get lua interpreter configured 1191 local lua = fs.Q(cfg.variables.LUA) -- get lua interpreter configured
1192 -- execute on configured interpreter, might not be the same as the interpreter LR is run on 1192 -- execute on configured interpreter, might not be the same as the interpreter LR is run on
1193 local result = fs.execute_string(lua..[[ -e "if loadfile(']]..filename..[[') then os.exit(0) else os.exit(1) end"]]) 1193 local result = fs.execute_string(lua..[[ -e "if loadfile(']]..filename..[[') then os.exit(0) else os.exit(1) end"]])
1194 return (result == true) 1194 return (result == true)
diff --git a/src/luarocks/fs/unix.lua b/src/luarocks/fs/unix.lua
index 61569e30..f3db5b30 100644
--- a/src/luarocks/fs/unix.lua
+++ b/src/luarocks/fs/unix.lua
@@ -108,7 +108,7 @@ function unix.wrap_script(script, target, deps_mode, name, version, ...)
108 end 108 end
109 109
110 local argv = { 110 local argv = {
111 fs.Q(dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)), 111 fs.Q(cfg.variables["LUA"]),
112 "-e", 112 "-e",
113 fs.Q(table.concat(luainit, ";")), 113 fs.Q(table.concat(luainit, ";")),
114 script and fs.Q(script) or [[$([ "$*" ] || echo -i)]], 114 script and fs.Q(script) or [[$([ "$*" ] || echo -i)]],
diff --git a/src/luarocks/fs/win32.lua b/src/luarocks/fs/win32.lua
index 1a35c3d4..1842ac4c 100644
--- a/src/luarocks/fs/win32.lua
+++ b/src/luarocks/fs/win32.lua
@@ -195,7 +195,7 @@ function win32.wrap_script(script, target, deps_mode, name, version, ...)
195 end 195 end
196 196
197 local argv = { 197 local argv = {
198 fs.Qb(dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)), 198 fs.Qb(cfg.variables["LUA"]),
199 "-e", 199 "-e",
200 fs.Qb(table.concat(luainit, ";")), 200 fs.Qb(table.concat(luainit, ";")),
201 script and fs.Qb(script) or "%I%", 201 script and fs.Qb(script) or "%I%",
diff --git a/src/luarocks/test/command.lua b/src/luarocks/test/command.lua
index 58fa22cb..afdb5cb6 100644
--- a/src/luarocks/test/command.lua
+++ b/src/luarocks/test/command.lua
@@ -2,7 +2,6 @@
2local command = {} 2local command = {}
3 3
4local fs = require("luarocks.fs") 4local fs = require("luarocks.fs")
5local dir = require("luarocks.dir")
6local cfg = require("luarocks.core.cfg") 5local cfg = require("luarocks.core.cfg")
7 6
8local unpack = table.unpack or unpack 7local unpack = table.unpack or unpack
@@ -31,7 +30,7 @@ function command.run_tests(test, args)
31 if not fs.exists(test.script) then 30 if not fs.exists(test.script) then
32 return nil, "Test script " .. test.script .. " does not exist" 31 return nil, "Test script " .. test.script .. " does not exist"
33 end 32 end
34 local lua = fs.Q(dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)) -- get lua interpreter configured 33 local lua = fs.Q(cfg.variables["LUA"]) -- get lua interpreter configured
35 ok = fs.execute(lua, test.script, unpack(args)) 34 ok = fs.execute(lua, test.script, unpack(args))
36 elseif test.command then 35 elseif test.command then
37 ok = fs.execute(test.command, unpack(args)) 36 ok = fs.execute(test.command, unpack(args))
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua
index dd05b4ac..0a900ecc 100644
--- a/src/luarocks/util.lua
+++ b/src/luarocks/util.lua
@@ -434,11 +434,11 @@ do
434 return '"' .. pathname .. '"' 434 return '"' .. pathname .. '"'
435 end 435 end
436 436
437 function util.check_lua_version(lua_exe, luaver) 437 function util.check_lua_version(lua, luaver)
438 if not util.exists(lua_exe) then 438 if not util.exists(lua) then
439 return nil 439 return nil
440 end 440 end
441 local lv, err = util.popen_read(Q(lua_exe) .. ' -e "io.write(_VERSION:sub(5))"') 441 local lv, err = util.popen_read(Q(lua) .. ' -e "io.write(_VERSION:sub(5))"')
442 if lv == "" then 442 if lv == "" then
443 return nil 443 return nil
444 end 444 end
@@ -457,8 +457,8 @@ do
457 457
458 local ljv 458 local ljv
459 if cfg.lua_version == "5.1" then 459 if cfg.lua_version == "5.1" then
460 -- Ignores extra version info for custom builds, e.g. "LuaJIT 2.1.0-beta3 some-other-version-info" 460 -- Ignores extra version info for custom builds, e.g. "LuaJIT 2.1.0-beta3 some-other-version-info"
461 ljv = util.popen_read(Q(cfg.variables["LUA_BINDIR"] .. "/" .. cfg.lua_interpreter) .. ' -e "io.write(tostring(jit and jit.version:gsub([[^%S+ (%S+).*]], [[%1]])))"') 461 ljv = util.popen_read(Q(cfg.variables.LUA) .. ' -e "io.write(tostring(jit and jit.version:gsub([[^%S+ (%S+).*]], [[%1]])))"')
462 if ljv == "nil" then 462 if ljv == "nil" then
463 ljv = nil 463 ljv = nil
464 end 464 end
@@ -502,17 +502,17 @@ do
502 local dir_sep = package.config:sub(1, 1) 502 local dir_sep = package.config:sub(1, 1)
503 for _, d in ipairs({ prefix .. dir_sep .. "bin", prefix }) do 503 for _, d in ipairs({ prefix .. dir_sep .. "bin", prefix }) do
504 for _, name in ipairs(names) do 504 for _, name in ipairs(names) do
505 local lua_exe = d .. dir_sep .. name 505 local lua = d .. dir_sep .. name
506 local is_wrapper, err = util.lua_is_wrapper(lua_exe) 506 local is_wrapper, err = util.lua_is_wrapper(lua)
507 if is_wrapper == false then 507 if is_wrapper == false then
508 local lv = util.check_lua_version(lua_exe, luaver) 508 local lv = util.check_lua_version(lua, luaver)
509 if lv then 509 if lv then
510 return name, d, lv 510 return lua, d, lv
511 end 511 end
512 elseif is_wrapper == true or err == nil then 512 elseif is_wrapper == true or err == nil then
513 table.insert(tried, lua_exe) 513 table.insert(tried, lua)
514 else 514 else
515 table.insert(tried, string.format("%-13s (%s)", lua_exe, err)) 515 table.insert(tried, string.format("%-13s (%s)", lua, err))
516 end 516 end
517 end 517 end
518 end 518 end
@@ -525,15 +525,15 @@ do
525 end 525 end
526 526
527 function util.find_lua(prefix, luaver, verbose) 527 function util.find_lua(prefix, luaver, verbose)
528 local lua_interpreter, bindir 528 local lua, bindir
529 lua_interpreter, bindir, luaver = find_lua_bindir(prefix, luaver, verbose) 529 lua, bindir, luaver = find_lua_bindir(prefix, luaver, verbose)
530 if not lua_interpreter then 530 if not lua then
531 return nil, bindir 531 return nil, bindir
532 end 532 end
533 533
534 return { 534 return {
535 lua_version = luaver, 535 lua_version = luaver,
536 lua_interpreter = lua_interpreter, 536 lua = lua,
537 lua_dir = prefix, 537 lua_dir = prefix,
538 lua_bindir = bindir, 538 lua_bindir = bindir,
539 } 539 }