View Full Version : Variable by Reference.
arkangel-fx 10-27-2009, 07:33 PM Hi guys, been coding mel for some time now, and never even bothered in finding out this since now. Is there a way i can pass a variable onto a function by reference? The way in C you would use a pointer to the variable.
Thanks in advance.
Cristian
|
|
sciLoop
10-27-2009, 10:20 PM
Put the variable in an array.
Arrays are passed by reference in Mel.
arkangel-fx
10-29-2009, 01:45 PM
Thats not the real solution, and definetly not the best programming practice. Ive seen somewhere over the net while doing some reading, the way to pass the reference, but i cannot find it :(
sciLoop
10-29-2009, 01:55 PM
I would swear you cannot do that with Mel. Only way is do it with an array.
And ity a good way to return more than one value to the calling procedure.
Mark-J
10-30-2009, 09:27 AM
Have a look at this thread, I put a simple example of pass by reference in it:
Pass-by-Reference (http://forums.cgsociety.org/showthread.php?f=89&t=814928)
It only works with arrays, (int or string) but is very useful.
Mark
arkangel-fx
10-30-2009, 01:06 PM
Well thanx a lot to both of you! Seems i'll have to live with passing them as arrays :(
CGTalk Moderation
10-30-2009, 01:06 PM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.