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 CLOSED
 
Thread Tools Search this Thread Display Modes
Old 12 December 2010   #1
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 ..


cheers
 
Old 12 December 2010   #2
Hi,
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");
};
 
Old 12 December 2010   #3
thank you having a play right now
 
Old 12 December 2010   #4
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 05:18 PM.


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