CValueSet:GetValueAt


The GetValueAt method returns the value at a specified index in the CValueSet. To fetch both the value and key, use GetAt.

Syntax

Value = CValueSet:GetValueAt( nIndex )

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

bullet.gif    Returns the Value at the specified index as a number, integer, string, or boolean.

bullet.gif    On failure, nil is returned.

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

n = 3

-- fetch at set index 3

Printf("Value[%d]= %d", n, S:GetValueAt(n))

-- result: Value[3] = 9

Related Topics

CValueSet class, Get, GetKeyAt, GetAt


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