string.length

ytsek's icon

Why does this return a tring length of 1?

function bang()
{
api = new LiveAPI(this.patcher, "live_set tracks 0 clip_slots 0 clip");
var CLIPNAME=api.get("name");
var TEST=CLIPNAME.length;

post (TEST);
}

Thank you.

ShelLuser's icon

That heavily depends on the contents of the clipslot you mention. For example; for all we know it could contain a clip which is named "1".

amounra's icon

I believe you are parsing the length of an ARRAY, as that is what the API returns as a result of get('name'). Try var TEST=CLIPNAME.join().length instead, I think that will work.

Cheers.

ytsek's icon

Yes, that works. Thank you very much amourna.

Ok, I'll move on with my patch till the next hurdle. :)