An easy one, I assume. Help me out!

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
  09 September 2005
An easy one, I assume. Help me out!

Hey guys,

I'm new to MEL, so excuse the stupid question:

If I, for example, want to make a procedure that takes two incoming strings, and then mashes them together and makes a variable out of their names, how would I do that?

For instance:
If you were to say mashUp("hall_", "oates");
then the mashUp proc would create a variable called $hall_oates ...

I don't need to do precisely that, but it's the only way I know how to ask the question. I need to create and refer to variables, but not explicitly...

Does that make any sense? Thanks!!

Brent
 
  09 September 2005
the eval command might help you out, something like this:


  $string1 = "hall";
   $string2 = "oates";
   $string3 = "test";
   
   eval("$" + $string1 + "_" + $string2 + " = \"" + $string3 + "\"");
   
   print $hall_oates;
  


good luck!

-z
 
  09 September 2005
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 11:41 PM.


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