JS objects and inlets/outlets

Lee's icon

Hi, if I send a JS object out of an outlet and print it, I get "jsobject xxxx" where I presume xxx is the address of the object (or something similiar), if I now pass that back into an inlet, is there anyway I can turn that back into a usable object?

thx

Jay Walker's icon

would love to know this as well!

Iain Duncan's icon

What you see printed is the string representation from JavaScript, meaning what the JS engine thinks it should use for printing. In the case of an array or list, it's just a memory address of some kind. To find out what Max thinks you sent out, wire from an outlet to a print object in max, and you'll see what you're dealing with after the conversion, which will let you know what it'll be if you then pass it *back into* JS. I can't say for certain (not having tested) that it'll never work, but I'm thinking it's very unlikely. HTH!

Iain Duncan's icon

It would, I agree, be really nice to have some comprehensive documentation in the javascript with exact details of the marshalling between max and JS, I've found myself doing a lot of trial and error there too, and getting hung up on the differences between JS dicts and arrays, and Max dicts and lists.