[Dev-luatex] Can \directlua be nested?
Jonathan Sauer
Jonathan.Sauer at silverstroke.com
Fri Feb 1 09:58:54 CET 2008
Hello
> My assumption was that everything is catcode 11 or 12 or some other
> harmless value. \directlua does indeed read the entire braced
> argument at once.
Thanks for your reply. When coming home yesterday, I experimented
a little bit, and the results do not seem to match your answer.
In Plain TeX:
\directlua0{%
tex.sprint('A')%
\directlua0{tex.sprint('B')}%
tex.sprint('C')%
}
This results in "LuaTeX error [string "luas[0]"]:1: attempt to index
global 'Btex' (a nil value)". So it seems that the first \directlua
expands its braced argument while reading it (possibly using
get_x_token), thus also expands the second \directlua which inserts
"B" into the token stream, resulting in "Btex.sprint('C')".
This on the other hand works:
\directlua0{%
tex.sprint('A')%
\directlua0{tex.sprint('tex')}%
.sprint('C')%
}
In this case, the second \directlua inserts the table name "tex" into
the token stream, resulting in "tex.sprint('C')".
What do you think?
> Best wishes,
> Taco
Jonathan
More information about the dev-luatex
mailing list