array: why does this not work?

David Vaughan dvk at dvkconsult.com.au
Mon Dec 2 02:15:01 EST 2002


On Monday, December 2, 2002, at 05:50 PM, Oliver Hardt wrote:

> hello:  i have the following function that basically replaces get 
> theArray[theKey];  put it.
>
> function gF_getA pArray, pKey
>   get pArray[pKey]
>   return it
> end gF_getA
>
Olli

No problem here. This is a working example of the code I used to test 
your code:

on mouseUp
   put empty into field "f1"
   -- put empty into field "f2"
   put freddo() into frog
   repeat for each item i in "a,c,b,d"
     put gF_getA(frog,i) & space after field "f1"
   end repeat
end mouseUp

function freddo
   put "Freddo" into frog["a"]
   put "Frog" into frog["b"]
   put "was" into frog["c"]
   put "here." into frog["d"]
   return frog
end freddo

function gF_getA pArray, pKey
   get pArray[pKey]
   return it
end gF_getA

I also tried 1-4 as indices. Everything worked as expected. The output 
is:
Freddo was Frog here

Do you have an error in the prior code or in display?

regards
David
>
>
>
>
> thank you for your help!  best, olli.
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list