[Dev-luatex] Can \directlua be nested?

Taco Hoekwater taco at elvenkind.com
Thu Jan 31 13:07:06 CET 2008


Jonathan Sauer wrote:
> Hello,
> 
> can \directlua be nested, i.e.
> 
> 	\directlua0{\directlua0{tex.print('foo()')}}
> 
> to call Lua function 'foo'?

\directlua is never called recursively, even though it sometimes
looks like it is. The example above is syntactically wrong, but
this works (ignoring \catcode issues):

   \directlua0{tex.print('\directlua0{foo()}')}

however, executation is serialized. The output of tex.print is
not seen until the end of the outer \directlua is reached.

Luatex's tex engine actually sees something like this:

   \directlua0{}\directlua0{foo()}

which is fine, as it does not recurse.

Best wishes, Taco



More information about the dev-luatex mailing list