I'm testing my script which has some array declaration in it. It goes like this:
string $ctrlList[] = {"ctrl1", "ctrl2", "ctrl3"};
But when I try to make a change in one of the element and re-excute it in Script Editor,ex. ctrl2-->ctrl4, ctrl2 wasn't replaced by ctrl4. If I print out the array, it's like
ctrl1 ctrl2 ctrl3 ctrl1 ctrl4 ctrl3
is there something i can do to clean it up first? otherwise I have to restart maya everytime for testing it...
I have a new problem now....now the data is right, but seems like there are lots of empty space in the begining. so when I try to get the 1st element in the array, it returns nothing. If I print it out, it's like:
You've probably put empty strings in the array. So it doesn't return nothing, it returns empty string. You can remove array elements using stringArrayRemove
Dont make global variables out of them. Let them die and create them anew for soome optionvars instead.
And yes this is actualy the basis of maya variables that you CANT reassign variables once they are declared they die whan their scope dies (and for global vars tahat means whan maya quits). Thats why you use names taht arent likely to reoccour for globals.