If I make mistakes in a Lua script and I call it from a .tex file via
\luadirect{
dofile("myscript.lua")
}
then I get a full stacktrace in the output of lualatex-compiler:
myscript.lua:3: attempt to compare nil with number
stack traceback:
myscript.lua:3: in function 'expected_number'
myscript.lua:9: in function 'fn2'
myscript.lua:13: in main chunk
[C]: in function 'dofile'
[\directlua]:1: in main chunk.
But if I call script from a console with
$ texlua myscript.lua
myscript.lua:3: attempt to compare nil with number
I just get the last entry of the error. How can I call texlua that it prints all entries in stacktrace out?
-- myscript.lua
function expected_number(x)
if x == 0 then return 0 end
if x < 0 then return -1 end
if x > 0 then return 1 end
end
function fn2(n)
local m = expected_number(n)
end
local y
fn2(y)
\directluarather than\luadirect?luawhen called via\directlua, but not when called astexluaor with--luaonly.