PDA

View Full Version : Why this error?


davegreenwood
05-29-2008, 09:48 AM
If I type:
string $sl[];
$sl=`ls -mat`;
print $sl;
I get a list of my materials:
lambert1
particleCloud1

but if I type:
string $sel[];
$sel=`ls -mat`;
print $sel;
I get:
// Error: string $sel[]; //
// Error: Invalid redeclaration of variable "$sel" as a different type. //

Mac Intel Maya2008 sp1

Is that variable name reserved or something??
scratching my head...
Dave.

nkls
05-29-2008, 09:55 AM
you have most likely used the variable name $sel earlier in the maya session...remember that all variables declared like that in the scripteditor are globals...

you should always try to use brackets around your scripteditor code to ensure you're not using global variables, like this:

{
string $sel[];
$sel....
}

RetroAnimator
05-29-2008, 09:57 AM
That's right. The variable $sel seems to have previously been created as a string by you. Both codes you gave are correct.

davegreenwood
05-29-2008, 11:47 AM
Ah ha, I suspected something like that, but just made a new scene, and did not quit and restart.
Thanks All.
Dave.

CGTalk Moderation
05-29-2008, 11:47 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.