Javascript TypeError: outlet is not a function

josh howard's icon

I have some super simple code

autowatch = 1;

var track = new LiveAPI("this_device canonical_parent");
var root = track.path.toString().replace(/['"]+/g, "");

var track$ = new LiveAPI(getCurrentClipIndex);
track$.path = root;
track$.property = "playing_slot_index";

function getCurrentClipIndex(index) {
index = index.toString().split(",")[1];
var clipPath = root + " clip_slots " + index + " clip";
var clip = new LiveAPI(null, clipPath);
var is_playing = parseInt(clip.get("is_playing"));
if (is_playing === 1) {
var key = clip.get("name");
log(key);
outlet(0, key.toString());
}
}

function log(message) {
post(message);
post("\n");
}


But when I run this code it freaks out and says that outlet doesn't exist. but when I look at other code examples there are a bunch of scripts with similar structures to this. can someone point out what I'm doing wrong? I'm using Max 8 with Ableton Live 10.1.

Thanks.

tyler mazaika's icon

Hi Josh, I ran your code and it seemed to work fine as long as I added "outlets = 1" declaration to the top. But when I remove that line I get "bad outlet index 0" error rather than the "Javascript TypeError: outlet is not a function" error that you titled your post with.

I can't think off the top of my head why "outlet" wouldn't be a function, unless you accidentally declared "outlet = 1" instead of "outlets = 1".

HTH,
Tyler

josh howard's icon

Actually i figured it out i needed a msg_float method in my code.

Maybe someone can point me to a document that has a flow chart that shows all the lifecycle methods in max's javascript?