[NTG-context] accessing tex variable on lua side

Hans Hagen j.hagen at xs4all.nl
Wed Nov 25 12:33:23 CET 2020


On 11/25/2020 11:54 AM, Jano Kula wrote:
> Hello,
> 
> running in circles I have to give up on such an easy thing as passing a 
> tex variable to lua (knowing everything is stored in lua).
> 
> \setvariable{test}{something}{HHHH}
> \starttext
> \getvariable{test}{something}\par
> % how to access the variable on lua end?
> \startluacode
> -- var =
> \stopluacode
> \stoptext
Never give up ...

\starttext

     \setvariable{test}{something}{HHHH}

     \getvariable{test}{something}\par

     \meaning\getvariable

     \startluacode
 
print(">>",tokens.getters.macro(tokens.getters.macro("??variables") .. 
"test:something"))
     \stopluacode

     \def\MyVariableSomething{JJJJ}

     \startluacode
         print(">>",tokens.getters.macro("MyVariableSomething"))
     \stopluacode

\stoptext

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list