[NTG-context] metafun- how to pass array as an argument

Peter Rolf indiego at gmx.net
Mon Jan 24 14:26:17 CET 2011


Am 24.01.2011 13:50, schrieb Peter Rolf:
> Am 24.01.2011 13:18, schrieb dalyoung:
>> \startbuffer[a]
>> path p;
>> numeric bwidth, u, lastpoint; 
>> u :=1cm; 
>> p := fullcircle scaled .3u;
>> lastpoint := 0;
>>
>> def draw_balls = %(expr s)
> def draw_balls(text s) =
> 
>>   draw (0,0) -- (0, u);
>>   for i=3,5,0,2,1,7:
>     for i=s:
> 
>> 	for j = 1 upto i:
>> 	draw p shifted (lastpoint+.32*j*u,.3u);
>> 	endfor;
>>   bwidth := .32i*u+.5u;
>>   draw (lastpoint,0) -- (lastpoint +bwidth,0) -- (lastpoint +bwidth,u);
>>   lastpoint := lastpoint+bwidth;
>>   endfor;
>> enddef;
>>
>> draw_balls;
>>
draw_balls(3,5,0,2,1,7)

sorry, i forgot to change this line.
example code is attached for testing...

>> \stopbuffer
>>
>> \starttext
>> \processMPbuffer[a]
>> \stoptext
> 
> works in mkii, but fails in mkiv. i use an outdated version (31.12.2010)
> here.
> 
> 
> ! LuaTeX error <main ctx instance>:1: attempt to call field 'feedback'
> (a nil value)
> stack traceback:
> 	<main ctx instance>:1: in main chunk.
> <argument> ....feedback("\currentMPgraphicname ")}
> 
> \processMPgraphic ...ntMPgraphicformat ", \!!bs #1
>                                                   ;\!!es , \!!bs
> \currentMPi...
> <argument> ...feedback("\currentMPgraphicname ")}}
>                                                   \endMPgraphicgroup
> \secondoftwoarguments #1#2->#2
> 
> l.25 \processMPbuffer[a]
> 
> ?
> 
> 
> best wishes,  Peter
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context at 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
> ___________________________________________________________________________________
> 

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.tex
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20110124/61e7e14a/attachment.ksh>


More information about the ntg-context mailing list