For example, the following statements have the same effect; each statement creates a linear list of
three names:
set workerList = ["Bruno", "Heather", "Carlos"]
set workerList = list("Bruno", "Heather", "Carlos")
To create an empty linear list:
•
Set the list to
[ ]
Creating property lists
The only way to create a property list is to use the list operator (
function to create a property list.
To create a property list:
•
Place the list elements within the list operator, and use commas to separate the elements.
Precede each property with the pound (#) sign, and separate each property from its value
with a colon.
For example, the following statements create two different property lists. Each list specifies the
Stage coordinates of a sprite.
sprite1Location = [#left:100, #top:150, #right:300, #bottom:350]
sprite2Location = [#left:400, #top:550, #right:500, #bottom:750]
To create an empty property list:
•
Set the list to
[:]
Setting and retrieving items in a list
Lingo lets you set and retrieve individual items in a list. The syntax differs for linear and
property lists.
To set a value in a linear list:
•
Use the equals (=) operator. (You can also use the
versions of Director.)
For example, the statement
second item in the list workerList.
To retrieve a value in a linear list:
•
Use the list variable followed by the number that indicates the value's position in the list. Place
square brackets around the number. (You can also use the
which were introduced in earlier versions of Director.)
For example, in the linear list
the expression
workerList[2]
is Heather.
.
.
workerList[2] = "Tiffany"
set workerList = ["Bruno ", "Heather ", "Carlos "]
represents the second value in the list workerList. The value
). You cannot use the
[ ]
command introduced in earlier
setAt
makes Tiffany the new value for the
or
getAt
getaProp
Writing Scripts with Lingo 399
list()
commands,
,
Need help?
Do you have a question about the DIRECTOR MX-USING DIRECTOR MX and is the answer not in the manual?