DeleteAt

From Director Online Wiki
Jump to: navigation, search
list.deleteat(index)
deleteat list, index

List command; deletes an item from a linear or property list at the specified position. The position is stated as a number, even for property lists. Only works with linear lists and property lists; other data types will generate an error.

Example

This example creates a list, then deletes an element from the list, then displays it.

samplelist = [#a, #b, #c, #d]
samplelist.deleteat(2)
put samplelist

displays:

    --"[#a, #c, #d]"

This example deletes an item from a property list. Notice that even though it's a property list, the item to be deleted with deleteAt() is a numeric index:

samplePropList = [#a:100, #b:200, #c:300, #d:400]
samplePropList.deleteat(2)
put samplePropList 

displays:

--"[#a:100, #c:300, #d:400]"