Skip to content

llList2List

list llList2List(list ListVariable, integer Start, integer End)

Returns a subset of entries from ListVariable, in a range specified by the Start and End indicies (inclusive).

Using negative numbers for Start and/or End causes the index to count backwards from the length of the string, so 0, -1 would capture the entire string.

If Start is greater than End, the sub string is the exclusion of the entries.

Parameters
ListVariable (list)
Start (integer)
End (integer)
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
}
}
}
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]
}
}

When Start is greater than End, the function returns the exclusion of the entries between them (instead of a wraparound). There is no built-in way to achieve a wraparound order of list elements using this function alone.