Passing parameters by reference

Pete pete at mollysrevenge.com
Fri Mar 9 21:13:23 EST 2012


I have an update on this.  If the parameter passed is simply the name of
the array with no key qualifications, all is fine.  LC only kicks up a fuss
when  you pass a qualified array like myArray[myKey].  Weird.
Pete

On Fri, Mar 9, 2012 at 5:05 PM, Dar Scott <dsc at swcp.com> wrote:

> Oh, that would be cool!
>
> Maybe the array could be global (or passed as a parameter) and the
> subscript passed.
>
> This works:
>
> add 1 to a["x"]
>
> ...  it seems like a reasonable thing to do.  There might be problems I
> don't see right off, such as access to the same array at two different
> levels at the same time.
>
> Dar
>
> On Mar 9, 2012, at 4:30 PM, Pete wrote:
>
> > I think I already know the answer to this so just confirming in case I'm
> > missing something
> >
> > Let's say I have a handler with a parameter that is passed by reference,
> eg
> > "command xyz @parm1".  If I try to pass an element of an array, eg "xyz
> > theArray[2]", I get a runtime error.  If, however, I pass the whole
> array,
> > eg "xyz theArray", all seems to work fine.
> >
> > That seems somewhat strange to me but apparently that's the way it is?
> >
> >
> >
> > --
> > Pete
> > Molly's Revenge <http://www.mollysrevenge.com>
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>


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



More information about the use-livecode mailing list