Lingo Dictionary > D-F > deleteAt

 

deleteAt

Syntax

list.deleteAt(number)
deleteAt list, number 

Description

List command; deletes the item in the position specified by number from the linear or property list specified by list.

The deleteAt command checks whether an item is in a list; if you try to delete an object that isn't in the list, Director displays an alert.

Example

This statement deletes the second item from the list named designers, which contains [gee, kayne, ohashi]:

designers = ["gee", "kayne", "ohashi"]
designers.deleteAt(2)

The result is the list ["gee", "ohashi"].

This handler checks whether an object is in a list before attempting to delete it:

on myDeleteAt theList, theIndex
	if theList.count < theIndex then
		beep
	else
		theList.deleteAt(theIndex)
	end if
end

See also

addAt