** nevermind***
2 mins after I posted this .. I figured out that I don't need to put "String" infront of the array
D'oh!"
************
What I'd like to do is remove the Namespace characters from the selected items in an array.
So far, I've done exactly that.
I've successfully removed the namespace name from the selected object, but now I'm having trouble putting that name back into the Array.
Last month I spent learning Python, so now my mind is twisted around.
Please help me to clean up this mess! :icon60:
string $array[] = `ls -sl`;
for($node in $array){
$arraynumber = 0;
string $buffer[];
tokenize $node ":" $buffer;
string $newname = $buffer[size($buffer)-1];
string $array[$arraynumber] = $newname; // <<< This obviously isn't the correct syntax.
// print $array[$arraynumber];
// print $newname;
$arraynumber = $arraynumber + 1;
}
The error in the code is::
"Cannot cast data of type string to string[]"
Replies
EDIT: i noticed you didnt rename things in the mel code so if you just want the names in a list you could do this.
Thanks Passerby! I appreciate the time & effort you put in doing this. I'll likely use your code for future reference
Though, the only reason why I had to do it with melscript, rather than Python, was it had to fit into a larger chunk of mel that I had written a couple months ago