new_matrix
The new_matrix function is a non-class version of the CMatrix:new method which creates and returns a new CMatrix object. You must call new before using any class methods or properties.
M = new_matrix()
Default constructor. The new CMatrix M has no elements.
M = new_matrix( CMatrix2 )
This is a copy constructor. The new CMatrix M is initialized to the members of the CMatrix2 argument.
M = new_matrix( nRows, nCols, val )
The new CMatrix M is initialized to the first nRows rows x nCols columns of value val.
val may be any type of Lua value, but defaults to 0.0 if omitted.
The following script shows the default constructor and the use of delete to free memory when the CMatrix will no longer be used by the script:
|
-- create a new instance of M of the CMatrix class. |
|
-- other uses of the class go here, between new and delete. |
|
-- deletes the object and its associated memory. |
The next example shows the use of all 3 constructors: default, copy, and initialization:
|
-- initialization constructor |
|
-- result: M1 = 25 |
|
-- copy constructor |
|
-- result: M2 = 25 |
|
-- default constructor |
|
-- set the first member |
|
-- result: M3 = 1 |
CMatrix class, Copy, new, delete
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics,
Inc. All Rights Reserved.