# llList2Integer

*LSL function*

```lsl
integer integer llList2Integer(list src, integer index);
```

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

- Returns: `integer`
- Energy: 10

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

:::note
Please read [this intro of how to iterate over a list in LSL](https://wiki.secondlife.com/wiki/User:Kireji_Haiku/How_to_deal_with_lists_in_LSL).
:::

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

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

## Caveats

- A string of hexadecimal notation (e.g. "0x12A") will be cast as a decimal integer.

## Examples

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

```lsl collapse={1-8, 14-18}
// 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/)
- [llList2Float](/functions/llList2Float/)
- [llList2String](/functions/llList2String/)

---

*Source: [LlList2Integer](https://wiki.secondlife.com/wiki/LlList2Integer) on the Second Life Wiki. Content from the Second Life Wiki articles LlList2Integer (revision 1194311, 2015-01-22), Template:Issues/SVC-798 (revision 190402, 2009-01-01), Template:HoverText (revision 379053, 2009-06-01) and Template:LSL Function/list/element (revision 1168793, 2012-06-11), CC BY-SA 3.0.*

---

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