[NTG-context] OT: Problem with writing macros into variables in LuaTeX

Wolfgang Schuster schuster.wolfgang at googlemail.com
Sun Mar 18 11:53:54 CET 2012


Am 18.03.2012 um 11:25 schrieb Jaroslav Hajtmar:

> Hello Gurus.
> Sorry for OT, but I solve one problem in parallel in ConTeXt and pure LuaTeX too and I got into trouble.
> I have a problem in  LuaTEX with putting macro name into global variables and their re-listing. In ConTeXt, the problem is not with it.
> 
> Here is my minimal LuaTeX example:
> 
> \directlua{function put2globvar(parameter) globvar=parameter end}
> \directlua{function getglobvar() tex.print(globvar) end}
> 
> \def\puttoglobvar#1{\directlua{put2globvar('#1')}}

Untested:

\def\puttglobvar#1{\directlua{put2globvar([==[\detokenize{#1}]==])}

You can also try to replace \detokenize with \unexpanded (in ConTeXt \normalunexpanded).

Wolfgang


More information about the ntg-context mailing list