[Dev-luatex] Can \directlua be nested?

Taco Hoekwater taco at elvenkind.com
Thu Jan 31 13:51:08 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()}')}
> 
> I'm not sure why: In your example, the second \directlua is
> expanded while the first \directlua expands its argument,
> just like in my example. You would have to surround it with
> \unexpanded or \detokenize (and \luaescapestring because of
> the backslash) to pass it unmodified to tex.print.

Yes, that's what I meant.

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.

Best wishes,
Taco




More information about the dev-luatex mailing list