# llDeleteSubList

*LSL function*

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

- `list src`: Source list to copy and modify.
- `integer start_index`: Starting index of the slice to remove (inclusive).
- `integer end_index`: Ending index of the slice to remove (inclusive).

- Returns: `list`
- Energy: 10

While the function result is different than **src**, **src** is not modified, remember to use or store the result of this function.

The opposite function would be [llListInsertList](/functions/llListInsertList/).

Returns a [list](https://wiki.secondlife.com/wiki/list) that is a copy of **src** but with the slice from `start` to `end` removed.

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

## Examples

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

```lsl
src = llDeleteSubList( src, start, end )
```

</details>

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

```lsl collapse={1-6}
default
{
    state_entry()
    {
        // Create a list of names
        list names = ["Anthony", "Bob", "Charlie", "Diane", "Edgar", "Gabriela"];

        // Now let's remove values at position 1 through 2.
        names = llDeleteSubList(names, 1, 2);

        // Result:
        // list names = ["Anthony", "Diane", "Edgar", "Gabriela"];

        // Now let's use an start number higher then our end number
        names = llDeleteSubList(names, 3, 1);

        // Result:
        // list names = ["Edgar"];
        // If start number higher then our end number, then we should imagine that the start and the end are missing before start and end.
        // Imagine it should be FROM_THE_LISTSTART_CUT: start, AND_FROM_THE_LISTEND_CUT: end ... more or less :))
        // names = llDeleteSubList(names, 3 -> , <- 1);

    }
}
```

</details>

## See also

### Functions

- [llListInsertList](/functions/llListInsertList/)
- [llListReplaceList](/functions/llListReplaceList/)
- [llList2List](/functions/llList2List/)

---

*Source: [LlDeleteSubList](https://wiki.secondlife.com/wiki/LlDeleteSubList) on the Second Life Wiki. Content from the Second Life Wiki articles LlDeleteSubList (revision 1194082, 2015-01-22) and Template:LSL Function/negative index (revision 1200041, 2016-05-02), CC BY-SA 3.0.*

---

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