Append

From Director Online Wiki
Jump to: navigation, search
append
Type: method
Version:  ?
Language: Lingo
Dependencies: none
Links/Related
setAt(), add()

List command; for linear lists only, adds the specified value to the end of a linear list. This differs from the add command, which adds a value to a sorted list according to the list's order.

If you are working with unsorted lists, the append() method is faster than add().

If you use append() or setAt() on a sorted list, the list becomes unsorted and subsequent use of [[[add]]() will place the new values at the end of the list.

Syntax

from MX 2004 Documentation

linearList.append(value)

Verbose Syntax

append linearList, value

Examples

vList = [1, 2, 3]
vList.sort()    -- unnecessary: for unsort demonstration only
vList.append(5) -- will be placed at the end, and will unsort the list
vList.append(4) -- will be placed at the end
put vList
-- [1, 2, 3, 5, 4]

See also