Dear List!
THis MWE must be faulty, but where is the error?
====================================================
\startluacode
userdata = userdata or {}
function userdata.file_exists (name)
local name = name
local f = assert ( io.open ( name, "r" ))
if f then
f:close ()
context ( name )
context ( " exists!" )
else
context ( name )
context ( " doesn't exist!" )
end
end
\stopluacode
\starttext
\def\lookupfile#1%
{\ctxlua{userdata.file_exists([==[#1]==])}}
\lookupfile{"$HOME/context-tests/AAA.lua"} % "AAA.lua" intentionally does exist
\lookupfile{"$HOME/context-tests/BBB.lua"} % "BBB.lua" intentionally doesn't exist
\stoptext
====================================================
It makes no difference in commenting out the first or the second "\lookupfile" command.
The error message eventually is always nearly the same:
token call, execute: [ctxlua]:8: "$HOME/context-tests/AAA.lua": No such file or directory
token call, execute: [ctxlua]:8: "$HOME/context-tests/BBB.lua": No such file or directory
I'm using:
LuaMetaTeX, Version 2.00.0
ConTeXt ver: 2019.10.10 18:15 MKIV beta fmt: 2019.10.12 int: english/english
Please, any ideas?
Regards,
Rudolf