CApphot:Copy
The Copy method duplicates the current CApphot and returns the new object. All properties are copied.
A = CApphot:Copy() |
where
A is a new CApphot containing the same properties as the current one. In place of CApphot, use the name of the actual object to be copied.
This method copies an existing CApphot and returns a reference to the new CApphot. You cannot copy a CApphot or any 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 CApphot class:
To create a CApphot that is a copy of the current object, use the Copy method. This creates a new CApphot B before duplicating the values of the current object A. For example,
|
-- Object A already exists, B is automatically created. |
To create a new CApphot that is a copy of an existing object (including all properties), use the copy constructor, as in
|
-- Object A already exists, B is automatically created. |
You can choose the copying syntax that fits best with your script.
The following script copies the members of CApphot A into a new CApphot A2:
|
|
|
-- construct a new CApphot object |
|
-- Set the value of nRadius1 |
|
-- Set the value of nRadius2 |
|
-- Set the value of nRadius3 |
|
-- Measure object at (x,y) in CImage I |
|
-- result: A Mag = 15.256 |
|
-- create a copy of A, including measurements |
|
-- result: B Mag = 15.256 |