CValueSet:RemoveAt CValueSet:SetAt

CValueSet:Set


TheSet method sets the value at the specified string key. This value replaces the current value at the key. The value must have the same type as the CValueSet object; otherwise, the value will be converted to the type of the CValueSet object.

Syntax

boolean = CValueSet:Set( strKey, number_value )

boolean = CValueSet:Set( strKey, integer_value )

boolean = CValueSet:Set( strKey, string_value )

boolean = CValueSet:Set( strKey, boolean_value )

bullet.gif    Sets the specified value at the string key, strKey.

bullet.gif    Returns false on failure, usually if the specified string key is not already in the CValueSet.

Example

The following example creates a CValueSet S and adds members to it:

S = new_valueset("number")

-- constructor for values of type "number"

S:Add( "first key", 15.5 )

-- add a key and value

S:Add( "second key", -7.23 )

-- add a key and value

S:Add( "third key", 0.923 )

-- add a key and value

Printf("v= %lg", S:Get("second key"))

-- returns: v= -7.23

S:Set( "second key", 0.791 )

-- set (replace) the value at the key

Printf("v= %lg", S:Get("second key"))

-- returns: v= 0.791

Related Topics

CValueSet Class, SetAt, RemoveAt, InsertAt


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