On Fri, 04 Oct 2013 10:54:37 +0200, Hans Hagen <pra...@wxs.nl> wrote:

On 10/4/2013 10:47 AM, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
Hello all,

how to call \let from within Lua?

I'd need to "\let\T=4" using Lua.

The following code doesn't work (not so surprisingly):

----
\startluacode
   a = 4
\stopluacode

\expandafter\let\expandafter\T=\cldcontext{a}

\starttext
   Test \T.
\stoptext
----

What's the correct way?

why let and not context.setvalue("T","4")

anyway ...

\startluacode
    a = 4
\stopluacode

\normalexpanded{\let\noexpand\T\cldcontext{a}}

\starttext
    Test \T.
\stoptext

You need more \expandafter because \cldcontext needs two expansion steps:
   
\expandafter\expandafter\expandafter\let\expandafter\expandafter\expandafter\T\expandafter\expandafter\expandafter=\cldcontext{a}
 but I wonder why you don use \def or \edef:
   \edef\T{\cldcontext{a}}

... OK, thank you, Hans & Wolfgang, for your responses.

Best regards

Lukas

--
Ing. Lukáš Procházka [mailto:l...@pontex.cz]
Pontex s. r. o.      [mailto:pon...@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

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

Reply via email to