Passing parameters by reference

Pete pete at mollysrevenge.com
Sat Mar 10 13:21:42 EST 2012


Dick:

Thanks for the script, another little nugget of knowledge added to my LC
store!

I have entered an enhancement request - it's # 10070

Dar:

The function in question is a general purpose one that gets called from
many places.  Sometimes I need to pass an array element and other times
just a simple variable so I'd rather not complicate things by passing in an
extra parameter that holds the array key if it is an array that's being
passed.  But that is a possible solution so thanks for the suggestion.

Bob:

Creating a temporary array works, of course, and that's what I'm doing for
now.  But it defeats the whole purpose of passing the parameter by
reference since now I have to put the temporary array back into the real
array after the call.  I may as well just change the function to return the
result of its code and pass the parameter by value instead of reference.

Pete

On Sat, Mar 10, 2012 at 12:06 AM, Dick Kriesel <dick.kriesel at mail.com>wrote:

> Hi, Dar.  LC has a way to get and set a node at any level of an array,
> without code that concatenates [ ] to specify the node.  In an array
> reference a single [ ] can enclose an array of keys, as you can see in the
> code below.  Put the following into a button and click it.  The code
> invokes the debugger so you can see the array and the result string on the
> variables tab.
>
> I agree it'd be good if LC could accept any array reference for invoking a
> handler that specifies pass-by-reference.  Pete, I'd be glad to vote for
> your enhancement request.
>
> -- Dick
>



-- 
Pete
Molly's Revenge <http://www.mollysrevenge.com>



More information about the use-livecode mailing list