Hmmm a East List question here for (MEL)

Hey guys I recently managed to get my script somewhat working however I was curious on the best method to edit a list.

as it stands now my list is fires

string $stat_element = “ANIM_root1”;
select -r $stat_element;
string $nodes[] = ls -sl -dag;
for($node in $nodes){
print ($node + “_rig”);
}

ANIM_root1
ANIM_Pelvis
ANIM_Spine01
ANIM_Spine02

however I need to add a parallel List which has

ANIM_root1_rig
ANIM_Pelvis_rig
ANIM_Spine01_rig
ANIM_Spine02_rig

I think it should be easy but I’m not sure how to do it.

Thanks in advance!

I’m not sure what you mean when you say “add a parallel List” so I made a few examples of things that might be and hopefully one of them will be what you’re looking for. Also, in MEL those are actually string arrays rather than lists so I’ll refer to them as arrays in the examples.


string $A[] = {"ANIM_root1", "ANIM_Pelvis", "ANIM_Spine01", "ANIM_Spine02"};
string $B[] = {"ANIM_root1_rig", "ANIM_Pelvis_rig", "ANIM_Spine01_rig", "ANIM_Spine02_rig"};

int $i;


// Example #1: Index into two (or more) matching arrays to make use of paired items.
print ("

Example #1:
");
for ($i=0; $i<size($A); $i++)
{
    print( $A[$i] + " in A relates to " + $B[$i] + " in B.
"); 
}


// Example #2: Make a new array from alternating items of A and B (kind of like zip).
print ("

Example #2:
");
string $result[] = {};
for ($i=0; $i<size($A); $i++)
{
    $result[size($result)] = $A[$i];
    $result[size($result)] = $B[$i];
}
print $result;


// Example #3: Append array B to the end of array A.
print ("

Example #3:
");
appendStringArray($A, $B, size($B));
print $A;