a basic mel question

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  12 December 2010
a basic mel question

i am starting the learning prosess and i could use a little help

string $all[]=`ls -sl`;
float $amount = size($all);
for ( $i = $amount-1; $i > -1; $i -- )
print ($all[$i]+" \n");

in the print command there is a error .... i just want to list the items that is in $all[] one at a time but it does not seem to like me pulling $i in there .... any advice ?

also is there some way i could get this to work ?

for ( $i = size($all)-1; $i > -1; $i -- )

because i would love to learn how to remove as many lines as posable early on ..

  12 December 2010
error appear because of the arraySize definition as float. It has to be integer. It force $i to be also float and index of array has to be integer.

string $all[]=`ls -sl`; int $amount = size($all);
print $amount;
for ( $i = $amount -1; $i > -1; $i -- )
print ($all[$i]+" \n");

to simplify you have to use this:
for ( $i = `size($all)`-1; $i > -1; $i -- )
print ($all[$i]+" \n");
  12 December 2010
thank you having a play right now
  12 December 2010
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 04:11 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.