# llList2ListStrided

*LSL function*

```lsl
list list llList2ListStrided(list src, integer start_index, integer end_index, integer stride);
```

- `list src`: Source strided list.
- `integer start_index`: Zero-based start index (inclusive).
- `integer end_index`: Zero-based end index (inclusive).
- `integer stride`: Number of entries per stride (defaults to 1 if less than 1).

- Returns: `list`
- Energy: 10

Returns a new list containing the first element of every stride in the strided list src within the inclusive range from start to end.

Returns a [list](https://wiki.secondlife.com/wiki/list) of all the entries in the [strided list](https://wiki.secondlife.com/wiki/List#strided-lists) whose index is a multiple of **stride** in the range `start` to `end`.

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

## Examples

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

```lsl
list mylist = [0,1,2,3,4,5,6];
list result_a = llList2ListStrided(mylist,0,-1,2); //start at first item in list, go to the end, return every 2nd item
//result_a == [0,2,4,6]

list result_b = llList2ListStrided(mylist,1,-1,2); //start at second item in list, go to the end, return every 2nd item
//result_b == [2,4,6]

list result_c = llList2ListStrided(mylist,2,-1,2); //start at third item in list, go to the end, return every 2nd item
//result_c == [2,4,6]
```

</details>

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

```lsl collapse={1-7, 13-21}
list menu = ["1", "one", "2", "two", "3", "three"];
default
{
    state_entry()
    {
        llListen(10, "", llGetOwner(), "");
    }
    touch_start(integer detected)
    {
        list buttons = llList2ListStrided(menu, 0, -1, 2);
        llDialog(llDetectedKey(0), "choose a number", buttons, 10);
    }
    listen(integer channel, string obj, key id, string message)
    {
        integer index = llListFindList(menu, [message]);
        if (index != -1)
        {
            llOwnerSay("you chose " + llList2String(menu, index + 1) + " (" + message + ")");
        }
    }
}
```

</details>

## Notes

### Starting at an offset

If you want every second (or third, etc.) item in each **stride** returned, rather than the first, use [llList2ListSlice](/functions/llList2ListSlice/) instead.

## See also

### Functions

- [llList2ListSlice](/functions/llList2ListSlice/)

---

*Source: [LlList2ListStrided](https://wiki.secondlife.com/wiki/LlList2ListStrided) on the Second Life Wiki. Content from the Second Life Wiki articles LlList2ListStrided (revision 1215161, 2023-10-25), Template:LSL Function/negative index (revision 1200041, 2016-05-02) and Template:LSL Function/stride (revision 1190281, 2014-05-03), CC BY-SA 3.0.*

---

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