[luatex] Getting macro expansions from Lua

Christophe Jorssen jorssen.leraincy at free.fr
Thu Jun 2 12:25:00 CEST 2011


2011/6/2 Paul Isambert <zappathustra at free.fr>:

> 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?

I did exactly the same thing (well, the first part, I don't understand
the second with the callback yet...) and got the same error but I felt
ashamed of posting it here thinking I may have missed something
trivial. So thank you Paul :-)

By the way, I would highly appreciate some basic usage examples ot the
token_filter callback and the token library.

TIA

Best regards

-- 
Christophe



More information about the luatex mailing list