[Dev-luatex] "error" in LuaTeX and Lua

Taco Hoekwater taco at elvenkind.com
Thu May 1 15:13:08 CEST 2008


Jonathan Sauer wrote:
> 
> 
> Of course, (A) is not a really relevant case, since no-one in their 
> right mind would call <error> without an appropriate message. Still, 
> it is a bit puzzling why there is no traceback.

This is also true in lua interpreter itself, I just copied the code.

lua.exe is a bit weird: error() does not generate an interactive
error, even though it does set a non-zero return value:

   [taco at ntg Taco_Test]$ lua -e 'error()'
   [taco at ntg Taco_Test]$ echo $?
   1
   [taco at ntg Taco_Test]$


> Also note how the traceback is wrapped in a slightly weird way. Most 
> likely this is because it is written using <texio.write>, which does 
> not reset its line length counter at a \r.

Yes, I have to fix that.

> This is LuaTeX, Version snapshot-0.25.3-2008042921 (Web2C 7.5.6)
> (Error2.tex
> ! LuaTeX error [Test]:1: 
> stack traceback:
> 	[C]: in function 'error'
> 	[Test]:1: in function 'd'
> 	[Test]:1: in function 'c'
> 	[Test]:1: in function 'b'
> 	[Test]:1: in function 'a'
> 	[Test]:1: in main chunk.
> l.14 }

This looks a lot better, but I would opt to keep the quotes, or output
text in <>'s, like Knuth does sometimes (no strong feelings about that
though. The literal "string" is definately overkill).

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'.

Cheers, Taco






More information about the dev-luatex mailing list