Am 09.03.2010 um 15:59 schrieb Hans Hagen:

> On 9-3-2010 15:24, Wolfgang Schuster wrote:
>> Am 09.03.10 15:17, schrieb Andreas Harder:
>>> Hi all,
>>> 
>>> I can't find a solution for the following example:
>>> 
>>> \starttext
>>> 
>>> \startMPpage
>>> draw origin for i=0 step 10 until 100 : ..{down}(i,0) endfor ;
>>> \stopMPpage
>>> 
>>> \startluacode
>>> context.startMPpage()
>>> context("draw origin"..for i=0,100,10
>>> do.."..{down}("..i..",0)"..end..";")
>>> context.stopMPpage()
>>> \stopluacode
>>> 
>>> \stoptext
>>> 
>>> Can someone help?
>> \startluacode
>> context.startMPpage()
>> context("draw origin")
>> for i=0,100,10 do
>> context(string.format("..{down}(%d,0)",i))
>> end
>> context(";")
>> context.stopMPpage()
>> \stopluacode
> 
> also, if you want it in pure lua, you can put:
> 
> context.startMPpage()
>  context("draw origin")
>  for i=0,100,10 do
>    context(string.format("..{down}(%d,0)",i))
>  end
>  context(";")
> context.stopMPpage()
> 
> in demo.cld and then run
> 
>  context demo.cld
> 
> and the following also works:
> 
> context.startMPpage()
>  context("draw origin")
>  for i=0,100,10 do
>    context("..{down}(%d,0)",i)
>  end
>  context(";")
> context.stopMPpage()
> 
> that is: format is built in

Thanks for further explanations. The following works too:

\startluacode
context.startMPpage()
  context("draw origin")
  for i=0,100,10 do
    context("..{down}("..i..",0)") – without %d
  end
  context(";")
context.stopMPpage()
\stopluacode

Or is this deprecated?

Greetings
        Andreas
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 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