Function expression with msg_float() doesn't work


    May 31 2014 | 5:51 am
    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;
    	}
    }

    • May 31 2014 | 8:48 am
      Hi !
      your "msg_float" is private to your newly created function body only . its not in "jsthis" scope .
    • May 31 2014 | 9:11 am
      #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;
    • May 31 2014 | 6:27 pm
      Thanks for that clarification.