Can't pass array function result as parameter
J. Landman Gay
jacque at hyperactivesw.com
Thu Mar 30 23:49:09 EST 2006
James Spencer wrote:
> My problem is that while the debugger shows tArray in my mouseUp
> handler to be valid and shows it to have been correctly modified, when
> I step into the library code for LibUseDifferentArray, it shows pArray
> as empty and the processing fails.
Also, I just found an old note about this from Scott Raney:
>>> I have seen other limitations. I can return an array from a function
>>> and pass an array as a parameter but not both in the same expression as
>>> in somFunction(buildArray()).
>
>
> This is because you can only pass arrays using *variables*, not as the
> return value of a function call. In C/C++/Java, trying to do the
> above where "someFunction" takes a reference would generate a syntax
> error. MC/RR, being an untyped language, just silently takes the
> scalar value (which in this case will be empty) if it can't find a
> variable when it gets to the called function. You can work around
> this by breaking it into two steps:
> get buildArray()
> get someFunction(it)
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list