[Dev-luatex] register a callback on macro expansion?

Taco Hoekwater taco at elvenkind.com
Tue Feb 20 10:08:23 CET 2007


Hi Jjgod,

Jjgod Jiang wrote:
> Hi,
> 
> I'm wondering if I can register a Lua function as callback on the
> expansion of a specific macro? I'm expecting something like this:
> 
> \def\hello#1{#1}
> 
> callback.register("macro.hello",lua_func_hello)
> 
> when using \hello{abc}, the lua_func_hello will get called and have
> access to the arguments of \hello (abc).
> 
> In this way, we can implement loop structure in lua (which I think
> is a cleaner way than tail recursion in TeX).

Not right now, but soon. (perhaps using a slighly different interface,
because your example makes the macro definition body pointless, and
that can be confusing).

Cheers, Taco







More information about the dev-luatex mailing list