CValueSet:SetType


The SetType method sets the type of values inthe CValueSet to one of the following: "number", "integer", "string", or "boolean". The CValueSet is automatically emptied to prepare for adding new values.

Syntax

bool = CValueSet:SetType( strNewType )

bullet.gif    Sets the type of values in the set, where strNewType is "number", "integer", "string", or "boolean".

bullet.gif    On failure, returns boolean false.

Example

The following example creates a CValueSet S and adds members to it, then returns the count of members:

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("Count= %d", S:Count())

-- result: Count = 3

S:SetType("string")

-- changes the CValueSet object to "string"

Printf("Count= %d", S:Count())

-- result: Count = 0 (the CValueSet was emptied)

Related Topics

CValueSet class, GetType


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