CMatrix:Empty CMatrix:Get

CMatrix:Exists


The Exists method returns true if a CMatrix member exists with the specified indices.

Syntax

bSuccess = CMatrix:Exists( row, col )

bullet.gif    row,col is the index of the member to test.

bullet.gif    If the member is initialized, this method returns true.

bullet.gif    If not initialized, false is returned.

Remarks

If you use Init then the first n x m members are set and this function will return true if tested with an index in range. Otherwise, members are uninitialized if you do not Set them or if you Remove them.

Example

The following script tests whether the matrix member at index [2][2] has been initialized:

M = new_matrix()

-- create a CMatrix

M:Set( 1, 3, 0.112 )

-- set member [1][3]

M:Set( 2, 4, 5.5 )

-- set member [2][4]

if M:Exists(2,2) then s = "yes"

-- has member [2][2] been set?

   else s = "no" end

 

Printf("M[2][2] exists= %s", s)

-- result: M[2][2] exists= no

Related Topics

CMatrix class, Count


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