Getattr And For Loops

Ok, here is my problem. I'm trying to go through a list of selected objects to change an attribute. Here is the code I am trying to get to work:

CODE
    string $selected[] = ls -selection;
    string $object, $type;
    int $size = size($selected);

 int $i;
    for($i = 0; $i < $size; $i++)
    {
 $object = $selected[$i];
 $type = `getAttr .\_lptType $object`;
    }

It tells me that it cannot evaluate more than one attribute, but to me it looks like that's what I'm doing, only evaluating one attribute! I have tried some other things, but can't seem to figure out why Maya is complaining! Thanks for any help

change $type = getAttr .\_lptType $object;

to $type = getAttr "$object+.\_lptType";

QUOTE(shadowmonk @ 09/28/05, 02:13 PM)
Ok, here is my problem.  I'm trying to go through a list of selected objects to change an attribute.  Here is the code I am trying to get to work:
CODE
    string $selected[] = ls -selection;
    string $object, $type;
    int $size = size($selected);

yes your right must be the lack of sleep now ythat i finaly got soem theres a EVEN shorter way of doing this namelyexecuteForEachObject ist a bit heavy on your tprocessing so its better not to use it unless yoru actualy doing something thats very ad hoc. And does not work too well either. but it has ists veryy limitted uses

Thanks a lot! Got it working