CImCombine:Copy


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

Syntax

C = CImCombine:Copy()

where

    C is a new CImCombine object containing the same values as the current one. On failure, nil is returned.

  

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 = CImCombine:new(A)

-- CImCombine A already exists

Choose the syntax that fits best with your script.

Example

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

C = CImCombine:new()

-- 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

Related Topics

new

SaveState

CImCombine class