Forums > Javascript

how to use string set number of outlets in objects like pack/ unpack/ sel etc.

Apr 03 2013 | 10:55 pm


JavaScript seems to be nice and easy but I’ve already got first problem :)
I would like to create object (let say unpack) with outlets equal to the specific argument (let say unpack_length). So when unpack_length = 5, unpack with 5 outlets is created.

The problem is – how to put those args in this line of code:
unpack = this.patcher.newdefault(500, 100, "unpack", "unpack_length");

I now how to split a string in js, but got no idea how to put single args in the line of code above.

Any help will be appreciated!

Apr 03 2013 | 11:50 pm


function make_unpack(unpack_len) {
var unpack_args = [];
for (i=0; i < unpack_len; i++) unpack_args[i] = "i";
this.patcher.newdefault(500, 100, "unpack", unpack_args);

Apr 15 2013 | 9:38 am

Thank you so much for this solution :) I’ve send you a prv, check it please!

Viewing 3 posts - 1 through 3 (of 3 total)

Forums > Javascript