CSet:Insert


The Insert method adds a member to the Set prior to a specified index.

Syntax

CSet:Insert( member, index )

bullet.gif    member is the object to insert.

bullet.gif    index is a number that specifies the insertion point, beginning at 1.

Remarks

The member is inserted before the member already existing at index. To insert prior to the beginning of the set, use index = 1. Insertion moves all the members down in the list to open up the new position at index. In comparison with insertion, the Append method adds a member at the end of the set and does not need to know the index.

Example

Suppose a CSet exists with name S and that it contains 10 strings. The following script inserts a new string "ABC" at index 5:

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

-- result: Count = 10

S:Insert("ABC", 5)

-- Insert the new string at position 5

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

-- result: Count = 11

Related Topics

CSet, Append


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.