CValueSet:RemoveAt


The RemoveAt method removes from the object the (key, value) pair at the specified index, beginning at 1. All members at higher indices are moved down 1 position to fill the removed location. This also reduces the CValueSet Count by 1.

Syntax

bool = CValueSet:RemoveAt( nIndex )

bullet.gif    Removes the member at index nIndex. Returns boolean true on success, otherwise, false.

Example

The following example creates a CValueSet S, adds members to it, then removes the member at index 2:

S = new_valueset()

-- constructor, default to values of type "number"

S:Add( "key 1", 15.5 )

-- add a key and value

S:Add( "key 2", -7125.23 )

-- add a key and value

S:Add( "key 3", 0.923 )

-- add a key and value

Printf("Value 2= %lg", S:GetAt(2))

-- result: Value 2= -7125.23

S:RemoveAt(2)

-- create S2 and initialize it to members of S

Printf("Value 2= %lg", S:GetAt(2)

-- result: Value 2= 0.923

Related Topics

CValueSet Class, Remove, Empty, SetAt


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