two questions: send and references

Trevor DeVore lists at mangomultimedia.com
Tue Sep 20 11:30:20 EDT 2005


On Sep 20, 2005, at 8:23 AM, Mark Wieder wrote:

> All-
>
> I've run up against a couple of problems here:
>
> 1. I'm trying to pass parameters using the "send" command. The problem
> is that "send" insists on interpreting these for me rather than
> sending them verbatim. In other words, if I try
>
> send "hi" && the long id of field "xyz" to field "abc" of card "argh"

Try stuffing the values you want to send into variables and then do  
this:

get the long id of field "xyz"
send "hi it" to field "abc" of card "argh"

> 2. I can pass a parameter by reference once. That is,
>
> local someArray
>
> on stuff @pArray, pIndex, pValue
>   put pValue into pArray[pIndex]
> end stuff
>
> stuff someArray, tUserID, tPassword
>
> works fine. But I need to pass a reference to someArray to another
> handler down the line. Is there a syntax that will allow me to do
> this? I need a second level of indirection and I can't figure out how
> to do it. I don't think passing the entire array back and forth is
> going to be an option. I miss pointers...
>
> on stuff @pArray, pIndex, pValue
>   stuff2 pArray, pIndex, pValue
> end stuff
>
> on stuff2 @pArray, pIndex, pValue
>   put pValue into pArray[pIndex]
> end stuff2
>
> stuff2 someArray, tUserID, tPassword

What you have above will work.  The array is passed by reference all  
the way down the line. In both cases you are passing the array by  
reference.  I do this in libraries all of the time.


-- 
Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com





More information about the Use-livecode mailing list