"I should also say that if I swap the last two function calls the error is inversed"
the only way to do that via MEL is to pass in a string, and use stringToStringArray & or regular expressions to break down and parse the string using functional logic, untill a conclusion about what type of data the string contains, after that its a simple casting the data into a varriable of the correct type and returning it.
/users/hewa
[url=/users/hewa/forums]
Sunny Jim
[/url]
Jan 20, 2013
/forums/mel/topics/variable-scope-issue--2 /forums/mel/topics/variable-scope-issue--2
Post id: 311293 /reported_items/new.html?reportable_id=311293&reportable_type=Discussion%3A%3APost
Hi All,
Can anybody tell me why the following code won't work?
global proc testFunction(string $attribute)
{
// OK I'm not specifying type here because I want to handle a range of attribute types.
$attribValues = getAttr $attribute
;
}
testFunction("|MyCustomNode.myFloatAttribute");
testFunction("|MyCustomNode.myVectorAttribute");
// Error: line 3: Cannot convert data of type float[] to type float. //
I just don't understand why I'm getting this error, the variable $attribValues is in function scope, so why does it seem to assume the type should be the same as the previous call???
I should also say that if I swap the last two function calls the error is inversed