Arrays: new and old keys, i
Colin Holgate
coiin at rcn.com
Sat Sep 13 12:34:43 EDT 2008
On Sep 13, 2008, at 12:22 PM, Mark Brownell wrote:
> It's been a while but I believe that that ordering is how the Lists
> worked in Director. You didn't assign them key names. They could
> have parameters too, divided by ":" You just put data into an
> ordered spot. To be honest I like the non order sometimes, the way
> it is in Rev.
Director has lists and property lists. With a list you would need to
understand the order of the data (which you can sort if you like),
with property lists you don't. You can also have lists of lists, and
use a dot syntax to get the properties. Here's some examples of how
you deal with it:
peoplelist = [[name:"Tom",height:"72",city:"New York"],
[name:"Dick",height:"68",city:"San Francisco"],
[name:"Harry",height:"74",city:"New York"]]
put peoplelist
-- [[#name: "Tom", #height: "72", #city: "New York"], [#height:
"68",#name: "Dick", #city: "San Francisco"], [#name: "Harry",
#height: "74", #city: "New York"]]
put peoplelist[1].name
-- "Tom"
put peoplelist[2].name
-- "Dick"
put peoplelist[3]
-- [#name: "Harry", #height: "74", #city: "New York"]
You'll notice that it didn't matter where the #name entry was, the
name was still found ok.
More information about the use-livecode
mailing list