Difference between revisions of "ObjectType:array"

From Lavish Software Wiki
Jump to navigation Jump to search
Line 10: Line 10:
  
 
== Returns ==
 
== Returns ==
 +
NULL
  
 
== Examples ==
 
== Examples ==
 +
===Declare an array of strings===
 +
*declare Array1[20] string
 +
===Declare a 3 dimensional array of floats===
 +
*declare Array2[20,15,5] float global
 +
===Display total dimensions of an array===
 +
*echo Dimensions: ${Array2.Dimensions}
 +
;Output
 +
Dimensions: 3
 +
===Display number of elements in a specific dimension===
 +
*echo Elements in dimension 2: ${Array2.Size[2]}
 +
;Output
 +
Elements in dimension 2: 15
 +
===Set and display the element at [2,3,1]===
 +
*Array2[2,3,1]:Set[149.23]
 +
*echo ${Array2[2,3,1]}
 +
;Output
 +
149.23
  
 
== See Also ==
 
== See Also ==

Revision as of 20:41, 26 August 2005

Description

Members

  • int Dimensions: Total number of extents of the array (e.g. 2-dimensional has two extents)
  • int Size: Total number of elements in the array, including all dimensions
  • int Size[#]: Total number of elements in a given dimension of the array

Methods

None

Returns

NULL

Examples

Declare an array of strings

  • declare Array1[20] string

Declare a 3 dimensional array of floats

  • declare Array2[20,15,5] float global

Display total dimensions of an array

  • echo Dimensions: ${Array2.Dimensions}
Output
Dimensions: 3

Display number of elements in a specific dimension

  • echo Elements in dimension 2: ${Array2.Size[2]}
Output
Elements in dimension 2: 15

Set and display the element at [2,3,1]

  • Array2[2,3,1]:Set[149.23]
  • echo ${Array2[2,3,1]}
Output
149.23

See Also