assign by reference (arrays)?

Michael D Mays michael at
Thu Mar 21 06:24:01 EST 2002

Ben Rubinstein of benr_mc at wrote the following on 3/20/02 8:05 AM

> on 20/3/02 1:16 PM, Jeanne A. E. DeVoto at jeanne at wrote:
>> At 4:57 AM -0800 3/20/2002, Ben Rubinstein wrote:
>>> Is there any way to assign by reference?
>> Calling parameters by reference:
>> If the name of a parameter variable is preceded with the @ character, that
>> parameter's value is a variable name, rather than the value in the
>> variable. Changing the parameter variable in the called handler changes the
>> value of the variable in the calling handler.
> Right, I get all that.  My point is that I can do it in a procedure, but I
> can't find a way to do it inline.
>>> I could do something like this
>>> (snip)
>>> .... provided that 'dostuffto' was declared to take the first parameter by
>>> reference.  But what if want to do the stuff inline?  I tried this:
>>> (snip)
>>> But this doesn't work
>>> (snip)
>>> So is there a way to say "put x into y" that means "make 'y' point to the
>>> same object as 'x'"???
> It seems counter-intuitive that I can make a parameter in subroutine refer
> to the same object as a variable in my routine, but I can't make two
> variables in my routines do so.

Why is it counter-intuitive? The variable it always is always a copy.

If you were saying
 get aRegularVariable
you wouldn't expect it be a 'reference' to aRegularVariable.

Maybe there should be a new command getHandler which would allow the
programmer to do what you want.

Maybe what you could do is to add an extra index to your array and use your
select statements to pick that index. Then you could 'read and write' your
data into that subarray.


More information about the use-livecode mailing list