2017-08-08 3 views
1

Ceci est mon code MEL, mais je ne sais pas pourquoi il ne fonctionne pas:passant tableau de chaînes par proc

window -width 150; 
columnLayout -adjustableColumn true; 
    button -label "Button 1" -command "Base"; 
    button -label "Button 2" -command "Top"; 
    button -label "Button 3" -command "test"; 
showWindow; 

global string $BaseCurves, $TopCurves; 

global proc Base() { 
    $BaseCurves=`ls -sl`; 
} 

global proc Top() { 
    $TopCurves=`ls -sl`; 
} 

global proc test() { 
    print $TopCurves[0]; 
} 

Je ne sais pas pourquoi j'ai cette erreur:

"$TopCurves" is an undeclared variable. 

Répondre

0

Essayez ceci:

global string $BaseCurves; 

window -width 150; 
columnLayout -adjustableColumn true; 
    button -label "Button 1" -command "Base"; 
    button -label "Button 2" -command "Top"; 
    button -label "Button 3" -command "test"; 
showWindow; 

global proc Base() { 
    $BaseCurves=`ls -sl`; 
}; 

global proc Top() { 
    $TopCurves=`ls -sl`; 
}; 

global proc test() { 
    string $TopCurves[0]; 
}; 

¡Espérons que cela aide!