CArray:Set


The Set method adds or changes the value of the member at a specified CArray index.

Syntax

CArray:Set( nIndex, value )

where

    nIndex is the member index to set, beginning at 1.

    value is the target value to assign to assign.

Example

The following script sets 2 of the CArray members. Other members, such as index 2, remain undefined:

A = CArray:new()

-- create a CArray

A:Set( 4, 10.5 )

-- set the member at index 4

A:Set( 1, 2.5 )

-- set the member at index 1

Printf("A[4] = %lg", A:Get(4) )

-- result: A[4] = 10.5

Printf("A[2] = %lg", A:Get(2) )

-- result: A[2] = 0

Related Topics

Init

CArray class