Can't send string to outlet?
I am trying to have a js object call a function in another js object. When I do a simple outlet(0,"functionNameAsString"); it doesn't do anything. I've put in a post() message in the function to make sure it's being called so that's not the problem. Even if I put a message object between my two js objects, the message box stays empty. I've tried using "set" prepended to the string I want to send but that didn't work either. Should I be using global variables instead? Is sending a string to the outlet not supported?
it is supported. can you post the part of your patch and the scripts?
Actually it's sending arguments that seems to be the hangup.
function loadbang(){
var msg = "test arg1";
post("jsObject1 loaded\n")
outlet(0, msg);
}
results in error js:no function test arg1
same string in a message box works fine.
Thats because you are sending the string/symbol "test arg1" instead of the list: test arg1.
you can either format you message as an array:
function loadbang(){
var msg = ["test", "arg1]";
post("jsObject1 loaded\n")
outlet(0, msg);
}
or put a [fromsymbol] after the first js
j
That did it! I'll be using the array of strings method. Thanks a million!
You can also write multiple arguments for the outlet/post functions (outlet(0, "test", "arg1");
).