
Lingo Dictionary
53
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
duplicate
command to create
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
on prepareMovie
handler or write the list as a field cast member,
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
list
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"]
Examples
This statement defines a list by making the
machinery
variable equal to the list:
set machinery = [#gears:6, #balls:3, #ramps:8]
This handler sorts the list aList and then displays the result in the Message window:
on sortList aList
alist.sort()
put aList
end sortList
If the movie issues the statement
sortList machinery
, where
machinery
is the list in the
preceding example, the result is [#balls:3, #gears:6, #ramps:8].
This statement creates an empty linear list:
set x = [ ]
This statement creates an empty property list:
set x = [:]
See also
add
,
addVertex
,
append
,
count()
,
deleteAt
,
duplicate() (list function)
,
findPos
,
findPosNear
,
getProp()
,
getAt
,
getLast()
,
getPos()
,
ilk()
,
list()
,
max()
,
min
,
setAt
,
setaProp
,
sort
Содержание DIRECTOR MX-LINGO DICTIONARY
Страница 1: ...Lingo Dictionary Macromedia Director MX...
Страница 756: ...Index 756...