CMatrix:Empty


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

Syntax

CMatrix:Empty()

  

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

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

Related Topics

delete

CMatrix Class