Thanks Wolfgang,
these are very valuable tips for me for the future. I put them to
special document for later use. Thanks again for the valuable advice.
Jaroslav Hajtmar
Dne 18.3.2012 14:00, Wolfgang Schuster napsal(a):
Am 18.03.2012 um 13:48 schrieb Jaroslav Hajtmar:
> Thanx Wolfgang.
>
> Thanks for the tip. I do too, but I did not know how to get into Lua code that the macro.
The one thing you have to know, when you pass a macro from TeX to Lua it is
expanded.
\def\foo{FOO}
\directlua{myfuntion("\foo")}
In this example the Lua function gets “FOO” as input and not “\foo” because the
argument of \directlua is expanded, to prevent you need a function which
prevents expansion.
\directlua{myfunction("\string\foo")}
Works only for the command after \string.
\directlua{myfunction("\detokenize{\foo}")
Converts \foo into tokens and Lua sees now \foo.
\directlua{myfunction("\unexpanded{\foo}")
Prevents the argument to be expanded and Lua gets \foo (there are differences
compared with \detokenize but I forgot them)
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________