CArray:Exists


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

Syntax

bSuccess = CArray:Exists( index )

bullet.gif    index 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 members are set and this function will return true if tested with an index in range. Otherwise, members are not initialized if you do not Set them or if you Remove them.

Example

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

A = new_array()

-- create a CArray

A:Set( 1, 0.112 )

-- set member [1]

A:Set( 2, 5.5 )

-- set member [2]

if A:Exists(6) then

-- has member [6] been set?

  s = "yes" else s = "no" end

 

Printf("A[6] exists= %s", s )

-- result: A[6] exists= no

Related Topics

CArray, Count


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