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

Jonathan Sauer Jonathan.Sauer at silverstroke.com
Tue Apr 29 10:05:59 CEST 2008


Hello,

the following PlainTeX example demonstrates some differences between
LuaTeX and plain Lua concerning the "error"-function:

--------------------------------------------------------------------

%&luatex

\directlua0{error()} % A
% \directlua0{error('')} % B

\end


(A) results in:

This is LuaTeX, Version snapshot-0.25.2-2008041019 (Web2C 7.5.6)
(Error.tex
! LuaTeX error ^^@?V[^^@^^@.
l.4 \directlua0{error()}
                         % A
?  


(B) results in:

This is LuaTeX, Version snapshot-0.25.2-2008041019 (Web2C 7.5.6)
(Error.tex
! LuaTeX error [string "luas[0]"]:1: .
l.5 \directlua0{error('')}
                           % B
? 


Compare with Lua ("error('')" only):

jonathansauer$ lua
Lua 5.1.2  Copyright (C) 1994-2007 Lua.org, PUC-Rio
> error('')
stdin:1: 
stack traceback:
        [C]: in function 'error'
        stdin:1: in main chunk
        [C]: ?
> 

--------------------------------------------------------------------

So there are two issues here:

1. When called in LuaTeX and with no parameters, <error> creates quite
   a creative error message.

2. When called in LuaTeX and with an error message, <error> does not
   display a stack traceback (contrary to the Lua interpreter).

The first one seems to be some kind of invalid pointer error (the
error message is read from somewhere in memory instead of being
omitted). The missing stacktrace is strange though.


Jonathan



More information about the dev-luatex mailing list