CValueSet:SetAt


The SetAt method sets the value of the (key, value) pair at the specified index, beginning at 1. The specified index must lready exist in the CValueSet. This method does not add a new member to the set.

Syntax

bool = CValueSet:SetAt( nIndex, value )

bullet.gif    Sets the value at index nIndex.

bullet.gif    Retruns false on failure or if nIndex is outside the range [ 1, Count() ].

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("Member= %s, %lg", S:GetAt(2))

-- result: Member= key 2, -7125.23

S:SetAt(2, 15.6)

-- set the value at index 2

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

-- result: Member= key 2, 15.6

Related Topics

CValueSet Class, Remove, Empty, Set


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