Difference between revisions of "Category:LSL List"

From Second Life Wiki
Jump to: navigation, search
m
(Added clarification on nesting of lists.)
Line 10: Line 10:
 
A list can grow dynamically as large as needed during execution, and is only limited by the amount of memory that script has available.  However, there is a 72 element limit to lists defined at compile time.
 
A list can grow dynamically as large as needed during execution, and is only limited by the amount of memory that script has available.  However, there is a 72 element limit to lists defined at compile time.
  
Lists cannot be nested.
+
Lists cannot be nested, this means that a list may not contain another list.
 +
 
 +
<pre>[1, "one", 2, "two"] + [3, "three"] returns [1, "one", 2, "two", 3, "three"]
 +
not [1, "one", 2, "two", [3, "three"]]</pre>
  
 
It is important to note that indexing starts at 0, not 1.
 
It is important to note that indexing starts at 0, not 1.
  
 
To access the individual elements use the llList2<type> functions.
 
To access the individual elements use the llList2<type> functions.

Revision as of 19:45, 14 June 2008

A list is a special kind of data type which can contain zero or more elements of any other data type. Lists are signified by square brackets surrounding their elements, which are separated by commas.

List examples:

[0,1,2,3,4], ["Yes","No","Perhaps"], [1,14.154,"Isn't this fun?",<0,0,0>]

A list can grow dynamically as large as needed during execution, and is only limited by the amount of memory that script has available. However, there is a 72 element limit to lists defined at compile time.

Lists cannot be nested, this means that a list may not contain another list.

[1, "one", 2, "two"] + [3, "three"] returns [1, "one", 2, "two", 3, "three"]
not [1, "one", 2, "two", [3, "three"]]

It is important to note that indexing starts at 0, not 1.

To access the individual elements use the llList2<type> functions.