[NTG-context] MP/Lua binding

Hans Hagen pragma at wxs.nl
Mon Dec 8 14:32:16 CET 2014


On 12/8/2014 1:45 PM, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
> Hello Hans,
>
>> it's possible to ask values from within mp:
>>
>> \starttext
>>
>> \startluacode
>> document.variables = {
>>      labels = {
>>          "one",
>>          "two",
>>          "three",
>>      }
>> }
>> \stopluacode
>>
>> \startMPpage
>>      numeric dx, dy;
>>      dx = 4.4cm;
>>      dy = 0.53cm;
>>      path b[];
>>      for i=1 upto lua("mp.print(\#document.variables.labels)") :
>>          b[i] = unitsquare xscaled dx yscaled dy shifted (0, (i-1)*dy);
>>          draw b[i];
>>          label(lua("mp.quoted(document.variables.labels[" & decimal i &
>> "])"), center b[i]);
>>      endfor
>> \stopMPpage
>>
>> \stoptext
>
> is there a doc where to study MP/Lua binding ("mp" members; examples) -
> like the manual "ConTeXt Lua Documents"?
>
> Here we can see Lua "mp.print()" and "mp.quoted()" usage...

article in bachotek proceedings and upcoming ctx group proceedings ... i 
might consider a manual indeed

Hans

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


More information about the ntg-context mailing list