CValueSet:Remove


The Remove method removes from the object the (key, value) pair at the specified key. 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:Remove( key )

bullet.gif    Removes the member with the key at string key. 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:Remove("key 2")

-- remove the (key, value) pair

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

-- result: Value 2= 0.923

Related Topics

CValueSet Class, RemoveAt, Empty, SetAt


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