Jonathan Sauer wrote:
I will also try if I can some equivalent of line numbers, maybe like so:
stack traceback: [C]: in function 'error' <Test>:4: in function 'd' <Test>:3: in function 'c' <Test>:2: in function 'b' <Test>:1: in function 'a' <Test>:6: in main
Actual input line numbers probably won't work because there can be code-generated token lists etc., but relative line numbers like this would definately be better than always '1'.
I'm not sure if that is possible, since TeX's input processor converts line endings to spaces when reading \directlua's <general text>, so Lua's loadstring only sees a single long line (which is also why Lua comments do not work inside \directlua).
Actually, \endlinechar = 10 \directlua ... already does the job, that is how I generated the example. You are right, I will have to leave this to the macro programmer. Cheers, Taco