# llKeyCountKeyValue

*LSL function (requires an experience)*

```lsl
key key llKeyCountKeyValue();
```

- Returns: `key`
- Energy: 10

Start an asynchronous transaction to request the number of keys with the script's [Experience](/categories/experience/).

Returns a [key](https://wiki.secondlife.com/wiki/key) that can be used to identify the corresponding [dataserver](/events/dataserver/) event to determine if this command succeeded or failed and the results.

```lsl title="How to use" frame="terminal"
key result = llKeyCountKeyValue();
```

## Examples

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

```lsl collapse={17-28}
key trans;
default
{
    state_entry()
    {
        trans = llKeyCountKeyValue();
    }

    dataserver(key t, string value)
    {
        if (t == trans)
        {
            // our llKeyCountKeyValue transaction is done
            list result = llCSV2List(value);
            if (llList2Integer(result, 0) == 1)
            {
                // data size retrieved
                llSay(0, "Keys in use: "+llList2String(result, 1));
            }
            else
            {
                // key count failed
                llSay(0, "Key-value failed to count keys: " + llList2String(result, 1) );
            }
        }
    }
}
```

</details>

## See also

### Functions

- [llGetExperienceErrorMessage](/functions/llGetExperienceErrorMessage/)
- [llCreateKeyValue](/functions/llCreateKeyValue/)
- [llReadKeyValue](/functions/llReadKeyValue/)
- [llUpdateKeyValue](/functions/llUpdateKeyValue/)
- [llDeleteKeyValue](/functions/llDeleteKeyValue/)
- [llDataSizeKeyValue](/functions/llDataSizeKeyValue/)
- [llKeyCountKeyValue](/functions/llKeyCountKeyValue/)
- [llKeysKeyValue](/functions/llKeysKeyValue/)

---

*Source: [LlKeyCountKeyValue](https://wiki.secondlife.com/wiki/LlKeyCountKeyValue) on the Second Life Wiki. Content from the Second Life Wiki articles LlKeyCountKeyValue (revision 1196393, 2015-05-05), Template:LSL Function/KeyValue (revision 1218517, 2025-11-17) and Template:LSL Function/Experience (revision 1210521, 2022-03-11), CC BY-SA 3.0.*

---

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