I have one complex function. I planned to send a function into it.
function ComplexFunction( customFunction : function)
{
//Complex things
customFunction();
//Complex things
}
But the function I planned to send has different signature
function FunctionA ( enumParameter : EnumX )
function FunctionB ( enumParameter : EnumY )
function FunctionC ( enumParameter : EnumZ )
So this is not an option because I don't know what type will be sending in.
function ComplexFunction( customFunction : function , enumForCustomFunction : Enum??? )
(This is Unity's javascript with #pragma strict, so I must indicate the parameter type.)
So I think about pre-apply those enum parameter, make it into parameter-less function and send that in for ComplexFunction
to call. Is this possible?
ComplexFunction(function () { return FunctionA(EnumX); });
) – Yoshi 23 mins ago