ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Lua & \let
@ 2013-10-04  8:47 Procházka Lukáš Ing. - Pontex s. r. o.
  2013-10-04  8:54 ` Hans Hagen
  2013-10-04  8:55 ` Wolfgang Schuster
  0 siblings, 2 replies; 4+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2013-10-04  8:47 UTC (permalink / raw)
  To: ConTeXt

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?

TIA.

Lukas


-- 
Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Lua & \let
  2013-10-04  8:47 Lua & \let Procházka Lukáš Ing. - Pontex s. r. o.
@ 2013-10-04  8:54 ` Hans Hagen
  2013-10-04  9:01   ` Procházka Lukáš Ing. - Pontex s. r. o.
  2013-10-04  8:55 ` Wolfgang Schuster
  1 sibling, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2013-10-04  8:54 UTC (permalink / raw)
  To: ntg-context

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



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Lua & \let
  2013-10-04  8:47 Lua & \let Procházka Lukáš Ing. - Pontex s. r. o.
  2013-10-04  8:54 ` Hans Hagen
@ 2013-10-04  8:55 ` Wolfgang Schuster
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfgang Schuster @ 2013-10-04  8:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 04.10.2013 um 10:47 schrieb Procházka Lukáš Ing. - Pontex s. r. o. <LPr@pontex.cz>:

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


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

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Lua & \let
  2013-10-04  8:54 ` Hans Hagen
@ 2013-10-04  9:01   ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 0 replies; 4+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2013-10-04  9:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, 04 Oct 2013 10:54:37 +0200, Hans Hagen <pragma@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:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-04  9:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-04  8:47 Lua & \let Procházka Lukáš Ing. - Pontex s. r. o.
2013-10-04  8:54 ` Hans Hagen
2013-10-04  9:01   ` Procházka Lukáš Ing. - Pontex s. r. o.
2013-10-04  8:55 ` Wolfgang Schuster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).