# llList2List

*LSL function*

```lsl
list list llList2List(list src, integer start_index, integer end_index);
```

- `list src`: Source list to slice.
- `integer start_index`: Zero-based start index (inclusive).
- `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](https://wiki.secondlife.com/wiki/list) that is a slice of **src** from `start` to `end`.

```lsl title="How to use" frame="terminal"
list result = llList2List([], 0, 0);
```

## Examples

<details open>
<summary>Example 1</summary>

```lsl
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
        }
    }
}
```

</details>

<details>
<summary>Example 2</summary>

```lsl
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]
    }
}
```

</details>

## See also

### Functions

- [llList2ListStrided](/functions/llList2ListStrided/) — Similar function for strided lists.
- [llDeleteSubList](/functions/llDeleteSubList/)
- [llListInsertList](/functions/llListInsertList/)
- [llListReplaceList](/functions/llListReplaceList/)

---

*Source: [LlList2List](https://wiki.secondlife.com/wiki/LlList2List) on the Second Life Wiki. Content from the Second Life Wiki articles LlList2List (revision 1217793, 2024-12-07) and Template:LSL Function/negative index (revision 1200041, 2016-05-02), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llList2List/
