lua.c loads 'readline' dynamically

(See comments in luaconf.h.) This change allows easier compilation,
as Lua compiles and works even if the package 'readline' is absent
from the system. Moreover, non-interactive uses don't load the library,
making the stand-alone slightly faster for small loads.
This commit is contained in:
Roberto Ierusalimschy
2024-07-04 17:11:58 -03:00
parent 781219dbe1
commit 366c855648
4 changed files with 90 additions and 29 deletions

View File

@@ -368,20 +368,18 @@ assert(string.find(t, prompt .. ".*" .. prompt .. ".*" .. prompt))
-- non-string prompt
prompt =
"local C = 0;\z
_PROMPT=setmetatable({},{__tostring = function () \z
C = C + 1; return C end})"
prompt = [[
local C = 'X';
_PROMPT=setmetatable({},{__tostring = function ()
C = C .. 'X'; return C end})
]]
prepfile[[ --
a = 2
]]
RUN([[lua -e "%s" -i < %s > %s]], prompt, prog, out)
local t = getoutput()
assert(string.find(t, [[
1 --
2a = 2
3
]], 1, true))
-- skip version line and then check the presence of the three prompts
assert(string.find(t, "^.-\nXX[^\nX]*\n?XXX[^\nX]*\n?XXXX\n?$"))
-- test for error objects