CValueSet:Add CValueSet:Count

CValueSet:Copy


The Copy method duplicates an instance of the CValueSet class or a table of pairs. The members of the old CValueSet or lua table become elements of the current CValueSet object. The CValueSet is emptied before the old object is copied. The type of the CValueSet becomes the type of the copied CValueSet. The new method may also be used to copy an existing CValueSet when the new object is created.

Syntax

count = CValueSet:Copy( CValueSetOld )

bullet.gif    Copies all members of CValueSetOld into the CValueSet object. Returns the number of members in the CValueSet.

count = CValueSet:Copy( tbl )

bullet.gif    Copies all pairs of the lua table into the CValueSet object. Each table member must consist of a string key and a value. Returns the number of members in the CValueSet.

Example

The following example creates a CValueSet S, adds members to it, then copies the members to a second CValueSet:

S = new_valueset()

-- constructa CValueSet object of type "number"

S:Add( "my first string", 15.5 )

-- add a key and value

S:Add( "my second string", -7125.23 )

-- add a key and value

S:Add( "my third string", 0.923 )

-- add a key and value

S2 = new_valueset()

-- construct a new CValueSet object

n = S2:Copy(S)

--copy the members of S into S2

Printf("CountNew= %d", n)

-- result: CountNew = 3

Related Topics

CValueSet Class, new, delete, CSet


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