PDA

View Full Version : sending/receiving variables through procedures


fluxgrafx
03-18-2005, 11:27 PM
kinda newbie here. how do i get the result of a variable in another procedure? for example..

// Start in this procedure

global proc getResultHere(string $otherStuff, string $otherStuff2)
{
// Do stuff and go to another procedure


// get the result of $array here
}

global proc AnotherProc()
{
// Do some stuff and send it to makeVariableHere
string $didStuff;
makeVariableHere($didStuff);
}


global proc makeVariableHere(string $didStuff)
{
string $array[]=`ls -sl`;
// Now I need to send this back to getResultHere
// Only prob is, it already has inputs
}


Hope this doesnt sound to confusing. Can I return the value of $array back to getResultHere?? Or can i ask for $array value from getResult here?

Zac256
03-19-2005, 12:22 AM
What you want to do is to pass the result like varType $variable = proc($vars). Then in another proc you do the same. otherVarType $anotherVar = anotherProc($moreVars) then send that as the return for the second proc. Hope that's what you were looking for. For more info, or links to some great mel tutorials send me an aim, or e-mail. (They're in the sig)

fluxgrafx
03-19-2005, 02:46 AM
Thanks. I figured it out. I was thinking there may be a way to just get the variable without having to pass it through each procedure, but I guess not.

CGTalk Moderation
03-19-2005, 02:46 AM
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.