Dear all,
I draw a simple figure using the code as below.
In the code, I use for i = 3,5,0,2,1,7: in def draw_balls.
However, if I can pass the array 3,5,0,2,1,7 as an argument for def
draw_balls (expr n) and call draw_balls (3,5,0,2,1,7), then it can be used for
different number of balls and
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:
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
Dear Peter,
Thank you for your help.
By changing (expr s) to (text s), it works!
I am using ConTeXt Minimal and the luatex version is This is LuaTeX, Version
beta-0.61.0-2010072816
Thank you again.
Dalyoung