CValueSet:GetAt


The GetAt method returns both the string key and value at a specified index in the CValueSet.

Syntax

strKey, Value = CValueSet:GetAt( nIndex )

bullet.gif    Where nIndex is an integer in the CValueSet, ranging from 1 to CValueSet:Count. If the index is invalid, nil, nil is returned.

bullet.gif    The strKey is the string key at the specified set index.

bullet.gif    The Value is the set value at the specified index as a number, integer, string, or boolean.

bullet.gif    On failure, nil, nil is returned. Note that this method returns 2 results.

Example

The following example creates a CValueSet S and adds members to it, then returns the value at the specified index:

S = new_valueset("integer")

-- constructor for a set of type "integer"

S:Add( "key 1", 15 )

-- add a key and value

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

-- add a key and value

S:Add( "key 3", 9 )

-- add a key and value

Printf("Result= %s,%d", S:GetKeyAt(2), S:GetAt(2))

-- result: Result= key_2, -7125

Related Topics

CValueSet class, Get, GetKeyAt, GetValueAt

 


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