Function expression with msg_float() doesn't work
Maybe there's a variety of things wrong with this but I'm trying to figure out why I can't use msg_float in a function expression. Does anyone understand why?
Does not work:
var mf = function msg_float(x) {
switch(inlet) {
case 1:
post('stuff');
break;
}
}
mf(x);
I get the error, "No function msg_float"
Works fine:
function msg_float(x) {
switch(inlet) {
case 1:
post('stuff');
break;
}
}
Hi !
your "msg_float" is private to your newly created function body only . its not in "jsthis" scope .
#EDIT
: deleted as i was referring to different case
u can use both functions
var mf = function(x){
post(x,"\n")
};
var msg_float = mf;
Thanks for that clarification.