function return??

Mar 28, 2013 at 3:54pm

function return??

hi all, I am quite new js, I am trying to make a simple function which outputs an array, composed of four arrays.
so if I have:
pOne = z;
pTwo = z;
pThree = z;
pFour = z;
array = new Array(pOne, pTwo, pThree, pFour);
return array;
it works!

and if I try:
pOne = new Array((x-scal), (y+scal), z);
pTwo = new Array((x+scal), (y+scal), z);
pThree = new Array((x+scal), (y-scal), z);
pFour = new Array((x-scal), (y-scal), z);
array = new Array(pOne, pTwo, pThree, pFour);
return array;
it outputs:
jsobject 141293048 jsobject 141293072 jsobject 141293096 jsobject 141293120

???

can anyone help me?

Attachments:
  1. test.zip
#67398
Mar 28, 2013 at 6:45pm

That’s because each element in your array is an array, so Max can’t interpret this.
If you do return array[0]; you’ll get your first array. Are you trying to join all the elements in a single array ?

#242459
Mar 28, 2013 at 8:05pm

Hell! I should have thought about that! :(
I must separate arrays when I call the function! And then output it.
thanks a lot for your help!

#242460

You must be logged in to reply to this topic.