Can't pass array function result as parameter
David Burgun
dburgun at dsl.pipex.com
Sat Apr 1 04:25:01 EST 2006
On 1 Apr 2006, at 05:01, James Spencer wrote:
>
> On Mar 31, 2006, at 8:59 PM, J. Landman Gay wrote:
>
>> If all else fails, you can always declare a local script variable
>> to hold the array and then just use that. No passing of anything
>> required. Or you could try passing the variable by reference (add
>> an @ sign in front of the parameter) which seems like it should
>> work but I haven't tried it.
>
> I think both would probably work but the issue at the moment is
> that I did not write the library that is creating the original
> array and that eventually expects me to pass an array back. The
> author had no reason to know that the output from their function
> creating the array would be passed back to the other handler as
> there is no necessary connection between the two and I don't want
> to mess with the library code myself mostly because I'm being
> pedantic.
>
> What definitely works is to copy the array myself, element by
> element, to a local variable and then pass that back to the
> library. This works fine in this limited situation because the
> number of entries in these "arrays" (I hate the name; in this
> context, they are really a dictionary or a hash) is limited and is
> predetermined so doing the extra copying works fine.
>
There's really no need to copy it entry by entry, you can just copy
the whole array as in:
put LibGetArray() into myArray1
put LibAnotherFunction(myArray1) into myArray2 --Here you could put
it back into Array1
I do this all the time.
What you can't do is this:
put LibAnotherFunction (LibGetArray()) into myArrayX
All the Best
Dave
More information about the use-livecode
mailing list