Nesting factory in parametric script

 From:  bemfarmer
4502.1 
Is there any information on nesting factory calls in javascript?
Trying to draw several parametric curves, in one script.
Manually repeating the script, with changing values, works ok.

Nested for loops haven't worked, so far. x,y,z values get lost.

Thank you.