create 1 spline from csv - need help please -

Hi everybody,

i need your help: I'm trying to write a script that allows me to import a *.csv file and create one single spline: (x,y,z Values)

here is how the csv will look like:

0,0,0
10,0,0
20,0,0
30,0,0
0,10,0
10,10,0
20,10,0
0,20,0
10,20,0

and here is my non working script:

(
local fName, theFile
theShape = splineShape name:"imported"

fName = getOpenFileName caption:"Select a .csv file to import" filename:"*.csv" types:"csv|*.csv"
if fName != undefined then
(
thefile = openFile fName mode:"r"
while not eof theFile do
(
x = readDelimitedString theFile "," as float
y = readDelimitedString theFile "," as float
z = readValue theFile as float

addKnot theShape 1 #corner #line
)
updateShape theShape
close theFile
)
)

I got the error:
-- Argument count error: addKnot wanted 6, got 4

Can someone tell me what I'm doing wrong? I'm unfortunately no script pro :(

br chris

solved by myself:

(
local fName, theFile
theShape = splineShape name:"imported"
addnewspline theShape

fName = getOpenFileName caption:"Select a .csv file to import" filename:"*.csv" types:"csv|*.csv"
if fName != undefined then
(
thefile = openFile fName mode:"r"
while not eof theFile do
(

x = readDelimitedString theFile "," as float
y = readDelimitedString theFile "," as float
z = readValue theFile as float

addKnot theShape 1 #corner #line [x,y,z]

)

updateShape theShape
close theFile
)
)