CMatrix:Empty


The Empty method deletes all members of the matrix but does not delete the CMatrix object.

Syntax

CMatrix:Empty()

Remarks

This deletes all matrix members without deleting the CMatrix object itself. If you delete the CMatrix, the object is set to nil and cannot be used again without creating a new instance using new. By calling Empty, the existing CMatrix can be used to Set new members, and so forth.

Example

The following script sets 3 members in a new CMatrix M, then deletes all members of M:

M = new_matrix()

-- create a CMatrix

M:Set( 127, 6000, -63.25 )

-- set member

M:Set( 100, 5, 12.34 )

-- set member

M:Set( 4, 600, -42 )

-- set member

Printf("Members = %d", M:Count())

-- result: Members = 3

M:Empty()

-- empty the matrix

Printf("Members = %d", M:Count())

-- result: Members = 0

M:delete()

-- if finished with M, clean up memory

Related Topics

CMatrix class, delete


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