CSet:Insert CSet:RemoveFirst

CSet:RemoveAt


The RemoveAt method removes a member from the CSet by its index position in the set.

Syntax

member = CSet:RemoveAt( index )

    index specifies the index of the member to remove.

    member is the set member that was removed.

    On success, this method returns the removed member.

    On failure, nil is returned.

Remarks

This method removes the member at an index. In comparison, the Remove method removes the set member by matching its value to set members. Removing a set member decreases the list length by 1 member. Removal does not delete the CImage or its associated image.

Example

Suppose a CSet exists with name S and that it contains 10 values. The following script fragment removes from the list the member at index 5:

 

Printf("count=%d", S:Count())

-- result: count=10

S:RemoveAt( 5 )

-- remove the member at index 5

Printf("count=%d", S:Count())

-- result: count=9

Related Topics

CSet, Remove, RemoveFirst, RemoveLast