# llList2Vector

*LSL function*

```lsl
vector vector llList2Vector(list src, integer index);
```

- `list src`: Source list containing the element of interest.
- `integer index`: Zero-based index of the entry.

- Returns: `vector`
- Energy: 10

Returns the vector value at index in the list src. Returns ZERO_VECTOR if the index is out of bounds or if the value cannot be type-cast.

Returns a [vector](https://wiki.secondlife.com/wiki/vector) that is at **index** in **src**.

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

## Caveats

- When used to typecast from a string it will result in a [ZERO_VECTOR](/constants/ZERO_VECTOR/)
- A true typecast will solve this: ([vector](https://wiki.secondlife.com/wiki/vector))[llList2String](/functions/llList2String/)(**src**, index);
- Unfortunately, if it was already a vector type, using [llList2String](/functions/llList2String/) will cause the decimal values to be truncated to six decimal places.
- In any string representation of a vector such as [llList2String](/functions/llList2String/)(**src**, index), or (string) `llList2Vector` (**src**, index), spaces are automatically added after the commas. When received by a [listen](/events/listen/), make sure NOT to parse by spaces.

## Examples

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

```lsl collapse={1-10}
// Best viewed in Chat History (ctrl-h)
default
{
    state_entry()
    {
        list my_list = ["a", 1, 2.0, <1,2,3>, <1,2,3,4>, llGetOwner()];
        integer i = ~llGetListLength(my_list);
        while(++i)
        {
            llOwnerSay("string=" + llList2String(my_list,i)
                        + "\n   integer=" + (string)llList2Integer(my_list,i)
                        + "\n   float=" + (string)llList2Float(my_list,i)
                        + "\n   vector=" + (string)llList2Vector(my_list,i)
                        + "\n   rot=" + (string)llList2Rot(my_list,i)
                        + "\n   key=" + (string)llList2Key(my_list,i) );
        }
    }
}
```

</details>

## Known issues

From the issue templates included by the wiki article:

- SVC-798 (nf): Perform typecasting with all llList2\* functions

## See also

### Functions

- [llGetListEntryType](/functions/llGetListEntryType/)
- [llList2String](/functions/llList2String/)

---

*Source: [LlList2Vector](https://wiki.secondlife.com/wiki/LlList2Vector) on the Second Life Wiki. Content from the Second Life Wiki articles LlList2Vector (revision 1194318, 2015-01-22), Template:Issues/SVC-798 (revision 190402, 2009-01-01), Template:LSL VR (revision 12853, 2007-02-23), Template:HoverLink (revision 58853, 2008-03-16) and Template:LSL Function/list/element (revision 1168793, 2012-06-11), CC BY-SA 3.0.*

---

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