Help with Arrays??

Mark Smith mark at maseurope.net
Tue Mar 21 05:49:24 EST 2006


Wow. The following meaningless script fails, (though it doesn't  
produce an error) ie. the result is simply 12 in the message box, the  
keys of the array are not sent to the message box...

on mouseUp
   showArray 12,makeArray(12)
end mouseUp

on showArray 12,tArray
   put x & cr & the keys of tArray
end showArray

function makeArray x
   repeat with n = 1 to x
     put 0 into tArray[n]
   end repeat
   return tArray
end makeArray


while

on mouseUp
   put makeArray(12) into tArray
   showArray 12,tArray
end mouseUp

works just fine...

Maybe this is a bug. Anyone else come across this?

Mark

On 21 Mar 2006, at 07:39, Arthur Urban wrote:

> I don't know what the heck is going on here, but I know it's making  
> me a wee bit testy. (I don't like needless local variables, what  
> can I say...)
>
> Here's the code that works just fine. Please note that I've  
> confirmed the value of x, it is not the problem here. The function  
> returns an Array.
>
>    put MyFunc( x ) into theArray
>    DisplayPurchaseLine x, theArray
>
> The following code fails miserably passing empty for theArray  
> argument; x is passed in just fine:
>
>    DisplayPurchaseLine x, MyFunc( x )
>
> Why do  I need to put the MyFunc() return value (an array) into a  
> local variable first. It clearly makes it out of the function call,  
> but cannot then immediately be used as a parameter. Huh?
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list