CValueSet:Add
The Add method adds a member at the end of the CValueSet object. Each member consists of a (key, value) pair. The value must be of type "number", "integer", "string", or "boolean" that matches the type of the CValueSet object. Otherwise, the value will be converted to the type of the object. The object type can be changed using the SetType method.
boolean = CValueSet:Add( key, number_value )
boolean = CValueSet:Add( key, integer_value )
boolean = CValueSet:Add( key, string_value )
boolean = CValueSet:Add( key, boolean_value )
Adds the (key, value) pair at the end of the CValueSet object and returns the index of the object or 0 on failure. The difference between a number and an integer is determined by the type of the CValueSet.
The following example creates a CValueSet S and adds members to it:
|
-- constructor, default to values of type "number" |
|
-- add a key and value |
|
-- add a key and value |
|
-- add a key and value |
|
|
The following example uses the CValueSet reated above. It resets the type and then adds string values to the same object:
|
-- change the type to "string". S is automatically emptied. |
|
-- add a key and value |
|
-- add a key and value |
|
-- add a key and value |
CValueSet Class, SetAt, RemoveAt, InsertAt, SetAt
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.