260
Examples
This statement identifies the value associated with the property #joe in the property list ages,
which consists of [#john:10, #joe:12, #cheryl:15, #barbara:22]:
put getaProp(ages, #joe)
The result is 12, because this is the value associated with the property #joe.
The same result can be achieved using bracket access on the same list:
put ages[#joe]
The result is again 12.
If you want the value at a certain position in the list, you can also use bracket access. To get the
third value in the list, associated with the third property, use this syntax:
put ages[3]
-- 15
Note:
Unlike the
getAProp
command where
VOID
is returned when a property doesn’t exist, a script error will occur
if the property doesn’t exist when using bracket access.
See also
getAt
,
getOne()
,
getProp()
,
setaProp
,
setAt
getAt
Syntax
getAt(
list
,
position
)
list
[
position
]
Description
List command; identifies the item in the position specified by
position
in the specified list. If
the list contains fewer elements than the specified position, a script error occurs.
The
getAt
command works with linear and property lists. This command has the same function
as the
getaProp
command for linear lists.
This command is useful for extracting a list from within another list, such as the
deskTopRectList.
Examples
This statement causes the Message window to display the third item in the answers list, which
consists of [10, 12, 15, 22]:
put getAt(answers, 3)
-- 15
The same result can be returned using bracket access:
put answers[3]
-- 15
Summary of Contents for DIRECTOR MX-LINGO DICTIONARY
Page 1: ...Lingo Dictionary Macromedia Director MX...
Page 756: ...Index 756...