Difference between revisions of "ObjectType:array"

From Lavish Software Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
== Description ==
 
== Description ==
 +
{{ObjectType-Vitals|array|[[LavishScript]]|[[ObjectType:objectcontainer|objectcontainer]]|NULL|none|yes|CDataArray *}}
 +
 
Arrays in LavishScript are 1-based i.e. ${MyArray[1]} references the first element in the array.
 
Arrays in LavishScript are 1-based i.e. ${MyArray[1]} references the first element in the array.
  
 
== Members ==
 
== Members ==
*[[DataType:int|int]] '''Dimensions''': Total number of extents of the array (e.g. 2-dimensional has two extents)
+
*[[DataType:uint|uint]] '''Dimensions''': Total number of extents of the array (e.g. 2-dimensional has two extents)
*[[DataType:int|int]] '''Size''': Total number of elements in the array, including all dimensions
+
*[[DataType:uint|uint]] '''Size''': Total number of elements in the array, including all dimensions
*[[DataType:int|int]] '''Size['''#''']''': Total number of elements in a given dimension of the array
+
*[[DataType:uint|uint]] '''Size['''#''']''': Total number of elements in a given dimension of the array
 
*[[ObjectType:mutablestring|mutablestring]] '''Expand['''begin #''','''length''']''': Retrieves the text representation of each object in the array as quoted parameters, separated by spaces.  If no parameters are given to Expand, the entire array will be used.  If only the begin # is used, the rest of the array, beginning with the element # specified, will be used.  If the length is additionally given, that number of elements from the array will be used, beginning with the element # specified as the beginning.
 
*[[ObjectType:mutablestring|mutablestring]] '''Expand['''begin #''','''length''']''': Retrieves the text representation of each object in the array as quoted parameters, separated by spaces.  If no parameters are given to Expand, the entire array will be used.  If only the begin # is used, the rest of the array, beginning with the element # specified, will be used.  If the length is additionally given, that number of elements from the array will be used, beginning with the element # specified as the beginning.
  
 
== Methods ==
 
== Methods ==
 
None
 
None
 
== Returns ==
 
NULL
 
  
 
== Examples ==
 
== Examples ==

Revision as of 15:25, 7 May 2006

Description

Object Type Vitals
array
Defined By LavishScript
Inherits objectcontainer
Reduces To NULL
Variable Object Type none
Uses Sub-Types yes
C/C++ Type CDataArray *

Arrays in LavishScript are 1-based i.e. ${MyArray[1]} references the first element in the array.

Members

  • uint Dimensions: Total number of extents of the array (e.g. 2-dimensional has two extents)
  • uint Size: Total number of elements in the array, including all dimensions
  • uint Size[#]: Total number of elements in a given dimension of the array
  • mutablestring Expand[begin #,length]: Retrieves the text representation of each object in the array as quoted parameters, separated by spaces. If no parameters are given to Expand, the entire array will be used. If only the begin # is used, the rest of the array, beginning with the element # specified, will be used. If the length is additionally given, that number of elements from the array will be used, beginning with the element # specified as the beginning.

Methods

None

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

Operates On

CDataArray *

This is an internal data type.

See Also