CArray:Get CArray:MaxIndex

CArray:Init


The Init method sets the first n CArray members to the same value.

Syntax

CArray:Init( n, value )

Remarks

This method first empties the CArray and then defines n array members at indices 1 ... n. After Init, MaxIndex and Count both return n.

Example

The following script fragment initializes the first 1000 members to a value of "name":

 

A = CArray:new()

-- create a CArray

A:Init( 1000, "name" )

-- set members 1 through 1000

Printf("A[500] = '%s'", A:Get(500) )

-- result: A[500] = 'name'

Related Topics

CArray, Set