CArray:new CArray:Set

CArray:Remove


The Remove method removes the CArray member at index n.

Syntax

value = CArray:Remove( n )

bullet.gif    n is the index of the member to be removed.

bullet.gif    On success, the value of the removed member is returned.

bullet.gif    Otherwise, nil is returned.

Remarks

The value returned corresponds to whatever type was saved into the CArray at the specified index. This may be a number, string, or other quantity

Example

The following script removes the member at index n = 10:

A = new_array()

-- create a CArray object

A:Set( 2, "s1" )

-- set member [2]

A:Set( 10, "s2" )

-- set member [10]

A:Set( 100, "s3" )

-- set member [100]

Printf("N = %d", A:Count() )

-- result: N = 3

v = A:Remove( 10 )

-- remove member [10]

Printf("N = %d, v='%s'", A:Count(), v )

-- result: N = 2, v='s2'

Related Topics

CArray, Count


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