outputting lists from js

Sep 15, 2006 at 3:27pm

outputting lists from js

Hi

I’m a relative newbie to this to JavaScript in Max, so apologies if this is a stupid question.
I want to get js to output a list so it can call a fuction with several arguments in another instance of js. I have tried this:

outlet(0,”setinstrument” + instrument + ” ” + 0);

[NB setinstrument = function in othe js; instrument is a variable]
When this arrives at the other instance of js it doesn’t recognise it.

In general how does one format lists to be sent of of js object?

Cheeeeeeers
Tom

#27647
Sep 15, 2006 at 3:40pm

split them up with a comma:

outlet(0, “elem1″, “elem2″, “elem3″, “elem4″)

cheers
evan

On Sep 15, 2006, at 4:27 PM, Tom Giles wrote:

>
> Hi
>
> I’m a relative newbie to this to JavaScript in Max, so apologies if
> this is a stupid question.
> I want to get js to output a list so it can call a fuction with
> several arguments in another instance of js. I have tried this:
>
>
> outlet(0,”setinstrument” + instrument + ” ” + 0);
>
>
> [NB setinstrument = function in othe js; instrument is a variable]
> When this arrives at the other instance of js it doesn’t recognise it.
>
> In general how does one format lists to be sent of of js object?
>
> Cheeeeeeers
> Tom

#83799
Sep 15, 2006 at 4:25pm

Wicked thanks. I’ve also found a multitude of other errors in the send/receive portion of my program, but it’s all working now.
Cheers
tom

#83800
Sep 15, 2006 at 4:34pm

Also, a nice thing about the JS object w/r/t arrays is that the
following are equivalent:

var elems = ["elem1", "elem2", "elem3", "elem4"];

outlet(0, “elem1″, “elem2″, “elem3″, “elem4″);
outlet(0, elems);

The reason you might want to use the second form is when you have
situations where you don’t know the length of the array or it isn’t
necessarily fixed.

wes

On 9/15/06, Tom Giles wrote:
>
> Wicked thanks. I’ve also found a multitude of other errors in the send/receive portion of my program, but it’s all working now.
> Cheers
> tom
>

#83801

You must be logged in to reply to this topic.