Each entry in a linear list is a single value that has no other property associated with it. Each entry
in a property list consists of a property and a value. The property appears before the value and is
separated from the value by a colon. You cannot store a property in a linear list. When using
strings as entries in a list, enclose the string in quotation marks.
For example, [6, 3, 8] is a linear list. The numbers have no properties associated with them.
However, [#gears:6, #balls:3, #ramps:8] is a property list. Each number has a property—in this
case, a type of machinery—associated with it. This property list could be useful for tracking the
number of each type of machinery currently on the Stage in a mechanical simulation. Properties
can appear more than once in a property list.
Lists can be sorted in alphanumeric order. A sorted linear list is ordered by the values in the list. A
sorted property list is ordered by the properties in the list. You sort a list by using the appropriate
command for a linear list or property list.
•
In linear lists, symbols and strings are case sensitive.
•
In property lists, symbols aren't case-sensitive, but strings are case-sensitive.
A linear list or property list can contain no values at all. An empty list consists of two square
brackets ([ ]). To create or clear a linear list, set the list to
the list to [:].
You can modify, test, or read items in a list.
Lingo treats an instance of a list as a reference to the list. This means each instance is the same
piece of data, and changing it will change the original. Use the
copies of lists.
Lists are automatically disposed when they are no longer referred to by any variable. When a list is
held within a global variable, it persists from movie to movie.
You can initialize a list in the
assign the list to a variable, and then handle the list by handling the variable.
Not all PC keyboards have square brackets. If square brackets aren't available, use the
function to create a linear list.
For a property list, create the list pieces as a string before converting them into a useful list.
myListString = numToChar(91) & ":" & numToChar(93)
put myListString
-- "[:]"
myList = myListString.value
put myList
-- [:]
put myList.listP
-- 1
myList[#name] = "Brynn"
put myList
-- [#name: "Brynn"]
Example
This statement defines a list by making the
-- Lingo syntax
machinery = [#gears:6, #balls:3, #ramps:8]
// JavaScript syntax
var machinery = propList("gears",6, "balls",3, "ramps",8);
608
Chapter 13: Operators
handler or write the list as a field cast member,
on prepareMovie
machinery
. To create or clear a property list, set
[ ]
command to create
duplicate
variable equal to the list:
list
Need help?
Do you have a question about the DIRECTOR MX 2004-DIRECTOR SCRIPTING and is the answer not in the manual?
Questions and answers