CSet:Copy
The Copy method duplicates the CSet and returns the new copy.
S = CSet:Copy() |
S is a new CSet containing the same members as the current one.
This method copies an existing CSet and returns a reference to the new CSet. You cannot copy a CSet or other class object using the trivial statement B = A, as this simply makes the value of B a reference to the object A. In other words, B becomes an alias to A. To get around this, two copy methods are provided by the CSet class:
To create a CSet that is a copy of the current object, use the Copy method. This creates a new CSet B before duplicating the values of the current object. For example,
|
-- CSet A already exists |
To create a new CSet that is a copy of an existing object, use the copy constructor, as in
|
-- CSet A already exists |
You can use the copying syntax that fits best with your script.
The following script duplicates a CSet.
|
-- create a CSet |
|
-- add a string to the set |
|
-- add a string to the set |
|
-- add a string to the set |
|
-- creates a duplicate CSet named T |
|
-- Result: N = 3 |
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.