Quotes Required Around Keys in 2 Dimensional Arrays?
David Vaughan
drvaughan55 at mac.com
Sun Apr 14 21:28:01 EDT 2002
On Monday, April 15, 2002, at 11:42 , Shao Sean wrote:
> * multi-dimension array are weird, especially when you're trying to loop
> through them
> * i haven't successfully been able to pass an array as a parameter to a
> function/handler (if someone has, please let me know how)
This script passes an array as parameter to another handler. Is there
something different you are after (other than less silly programs of
course)?
on mouseUp
put "moo" into ansn["cow"]
put "miaow" into ansn["cat"]
put "woof" into ansn["dog"]
freddo ansn
end mouseUp
on freddo frog
put frog["cat"]
end freddo
-- puts miaow in the message box
>
> after those i really haven't even touched arrays until yesterday for the
> project we're working on, but the array is a simple one-dimension
> array, but
> there is one piece of the puzzle where passing multi-dimension arrays
> would
> be very handy..
Rev uses content-addressable arrays. To create a multi-dimensional array
just enter two keys. For example:
on mouseUp
put "moo" into ansn["cat",1]
put "miaow" into ansn["cat",2]
put "woof" into ansn["cat",3]
freddo ansn
end mouseUp
on freddo frog
ask "enter 1-3"
put frog["cat",it]
end freddo
Actually, it is still a single dimensional array with an extended key
but it looks and works like a multi-dimensional one...
cheers
David
>
> _______________________________________________
> 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