Skip to content
lsl.devlsl.devLSL Dev

llList2List

function
Function syntax
list llList2List(
  1. list src,// Source list to slice.
  2. integer start_index,// Zero-based start index (inclusive).
  3. integer end_index// Zero-based end index (inclusive).
);
Returns
list
Energy
10

Returns a new list containing the subset of entries from src within the inclusive range specified by the start and end indices. Negative indices count backward from the end.

Returns a list that is a slice of src from start to end.

How to use
list result = llList2List([], 0, 0);
Example 1
list numbers = [1, 2, 3, 4, 5];
default
{
state_entry()
{
integer index = llListFindList(numbers, [3]);
if (index != -1)
{
list three_four = llList2List(numbers, index, index + 1);
llOwnerSay(llDumpList2String(three_four, ","));
// Object: 3,4
}
}
}
Example 2
default
{
state_entry()
{
//as shown below, there is no way to achieve a "wraparound" order of list elements [8,9,0,1]
list NUMBERS = [0,1,2,3,4,5,6,7,8,9];
list L2L;
L2L = llList2List(NUMBERS, 8, 1); // [0,1,8,9]
L2L = llList2List(NUMBERS, 8,-9); // [0,1,8,9]
L2L = llList2List(NUMBERS,-2,-9); // [0,1,8,9]
L2L = llList2List(NUMBERS,-2, 1); // [0,1,8,9]
}
}
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.