CImCombine:Copy


The Copy method duplicates the current CImCombine and returns the new object.

Syntax

C = CImCombine:Copy()

bullet.gif    C is a new CImCombine object containing the same values as the current one.In place of CImCombine:, use the name of the object to be copied.

Remarks

This method copies an existing CImCombine and returns a reference to the new CImCombine. You cannot copy a CImCombine 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 CImCombine class:

To create a CImCombine that is a copy of the current object, use the Copy method. This creates a new CImCombine B before duplicating the values of the current object A. For example,

 

  B = A:Copy()

-- CImCombine A already exists

To create a new CImCombine that is a copy of an existing object, use the copy constructor, as in

 

  B = new_imcombine(A)

-- CImCombine A already exists

You can use the copying syntax that fits best with your script.

Example

The following script duplicates the CImCombine C into a new CImCombine C2:

C = new_imcombine()

-- create a CImCombine

C:SetVerbose(true)

-- set some members

C2 = C:Copy()

-- creates a duplicate CImCombine A2

Printf("verbose = %d", C2.bVerbose )

-- result: verbose = 1

C:delete()

-- if finished with A, clean up memory

Related Topics

CImCombine class, new, SaveState


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