CMatrix:Rows


The Rows method returns the maximum row index in the CMatrix. This is the number of rows needed to hold every possible index in a completely filled rectangular matrix.

Syntax

number = CMatrix:Rows()

bullet.gif    On success, this method returns the maximum row index.

bullet.gif    On failure, this method returns 0.

Remarks

This method returns the maximum row index in the matrix. Since all indices do not have to be filled in a sparse matrix, the returned value is not the same as the number of rows. For example, if the CMatrix has 1 row with 2 members, one at index [1][1] and the other at index[1][10000], then Rows = 1.

Example

Suppose a CMatrix assigned to M contains 3 members as shown below:

M = new_matrix()

-- create a CMatrix

M:Set( 2, 44, 1805)

-- set member 2, 44

M:Set( 50, 20, 102)

-- set member 50, 20

M:Set( 120, 2, 600.5)

-- set member 120, 2

Printf("Rows = %d", M:Rows())

-- result: Rows = 120

M:delete()

-- if finished with M, clean up memory

Related Topics

CMatrix class, Exists


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