[luatex] Getting macro expansions from Lua

Paul Isambert zappathustra at free.fr
Thu Jun 2 11:22:27 CEST 2011


Le 02/06/2011 10:28, Taco Hoekwater a écrit :
> On 06/01/2011 05:01 PM, Reiner Pope wrote:
>>
>> What I'm looking for is a way to do this without nesting
>> \directlua{tex.sprint("\directlua{...}")}.
>
> Not possible yet (but it is on the todo list).

I wanted to try some hack with token.create/token.expand, but I found that:

\def\A{1}
\directlua{
   local A = token.create("A")
   token.expand(A)
}

produces an "Undefined control sequence" error. Which is all the more 
surprising as if the token is fed to TeX in the token_filter callback, 
as in the stupid example below, the control sequence is fine:

\def\A{1}
\directlua{
callback.register("token_filter",
   function ()
     callback.register("token_filter", nil)
     return token.create("A")
   end)
}

Have I misunderstood something or should I pay a visit to the bug tracker?

Best,
Paul


More information about the luatex mailing list