Difference between revisions of "ObjectType:index"

From Lavish Software Wiki
Jump to navigation Jump to search
Line 7: Line 7:
 
* sub-type '''Get['''#''']''': Retrieves the #th element in the index
 
* sub-type '''Get['''#''']''': Retrieves the #th element in the index
 
* [[ObjectType:uint|uint]] '''Insert['''...''']''': Inserts an element in the index.  The parameters will be passed to the object initialization routine for the index sub-type, and an object will be created.  The returned value is the ID of the new element.
 
* [[ObjectType:uint|uint]] '''Insert['''...''']''': Inserts an element in the index.  The parameters will be passed to the object initialization routine for the index sub-type, and an object will be created.  The returned value is the ID of the new element.
*[[ObjectType:mutablestring|mutablestring]] '''Expand['''begin #''','''length''']''': Retrieves the text representation of each existing 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 existing object in the index as quoted parameters, separated by spaces.  If no parameters are given to Expand, the entire index will be used.  If only the begin # is used, the rest of the index, beginning with the element # specified, will be used.  If the length is additionally given, that number of elements from the index will be used, beginning with the element # specified as the beginning.
*[[ObjectType:mutablestring|mutablestring]] '''ExpandComma['''begin #''','''length''']''': Retrieves the text representation of each existing object in the array as quoted parameters, separated by commas.  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]] '''ExpandComma['''begin #''','''length''']''': Retrieves the text representation of each existing object in the index as quoted parameters, separated by commas.  If no parameters are given to Expand, the entire index will be used.  If only the begin # is used, the rest of the index, beginning with the element # specified, will be used.  If the length is additionally given, that number of elements from the index will be used, beginning with the element # specified as the beginning.
  
 
== Methods ==
 
== Methods ==

Revision as of 15:43, 7 May 2006

Description

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

An index is a dynamically-sized list of objects. In contrast to arrays, elements in an index are not created when the index is sized -- the elements do not exist until set.

Members

  • uint Next[#]: Retrieves the ID of the next valid element in the index, given an ID number
  • sub-type Get[#]: Retrieves the #th element in the index
  • uint Insert[...]: Inserts an element in the index. The parameters will be passed to the object initialization routine for the index sub-type, and an object will be created. The returned value is the ID of the new element.
  • mutablestring Expand[begin #,length]: Retrieves the text representation of each existing object in the index as quoted parameters, separated by spaces. If no parameters are given to Expand, the entire index will be used. If only the begin # is used, the rest of the index, beginning with the element # specified, will be used. If the length is additionally given, that number of elements from the index will be used, beginning with the element # specified as the beginning.
  • mutablestring ExpandComma[begin #,length]: Retrieves the text representation of each existing object in the index as quoted parameters, separated by commas. If no parameters are given to Expand, the entire index will be used. If only the begin # is used, the rest of the index, beginning with the element # specified, will be used. If the length is additionally given, that number of elements from the index will be used, beginning with the element # specified as the beginning.

Methods

  • Remove[#]: Removes a single element from the index, by ID
  • Collapse: Removes gaps in the index (from removal of elements) by shifting elements toward 1
  • Move[#,#]: Moves an element to a new position in the index, by ID numbers. If an element exists in the new position, it is destroyed
  • Swap[#,#]: Swaps two positiosn in the index
  • Set[#,...]: Creates a new element in the index at the given position (destroying the previous element, if it existed). The additional parameters will be passed to the object initialization routine for the index sub-type, and an object will be created.

Examples

See Also