putAppleListItem

Syntax putAppleListItem (item, position, listAddr)

Params item is the value to be added to the list, and can by any type.

position is a numeric index or a string4 key indicating where the list item should be placed in the list.

listAddr is the address of a binary value containing an Apple event descriptor list, or where such a value should be created.

Action Adds item to the descriptor list at itemAddr with the index or key indicated by position. If no object exists at itemAddr, a new list is created according to the type of position: if a key is provided, a keyed list is created (an AERecord); if an index is

provided, an indexed list is created (a descriptor list).

Returns True

Examples putAppleListItem ("hello", 'word', @sample.keyList)
» true «the string value with the key 'word' was added to the list

putAppleListItem ("world", 2, @sample.descList)
» true «the second item in the list was set to be the string value

Errors If there is an object at listAddr that is not a binary value containing a valid descriptor list, an error occurs.

If position is a string4 keyword, and the list is not a keyed list, or if an index is provided that is out of range, an error occurs.

Platform Notes This verb is only implemented in the Mac OS version of Frontier.

Notes Frontier 3.0 and above supports direct list and record manipulation using square bracket syntax and addition.

Passing a zero index in position indicates that the item is to be added at the end of the list.

If an item with the given index or key already exists in the descriptor list, the new value replaces the existing one.

See Also countAppleListItems

getAppleListItem

[ ]

Discuss