# key-interaction

{% hint style="info" %} <mark style="color:yellow;">Key Interaction</mark> is the same as <mark style="color:yellow;">TextUI</mark> but reworked to allow multiple keys. TextUI wasn't removed to maintain compatibility with scripts that are already using it. It doesn't affect anything.
{% endhint %}

## Key Interaction

<figure><img src="https://share.lvsoft.com.ar/images/JryQd.jpg" alt=""><figcaption></figcaption></figure>

***

### How to use:

Client-side using exports

**Example:**

```lua
-- show up key-interaction
-- exports.lvs_lib:keyInteraction(method, items)
exports.lvs_lib:keyInteraction('show', {
    {key= 'E', text= 'Action #1'},
    {key= 'F', text= 'Action #2'},
})

-- simulate keypress and hide key-interaction
-- exports.lvs_lib:keyInteraction(method, [itemIndex])
exports.lvs_lib:keyInteraction('pressed', 1)

-- hide key-interaction
exports.lvs_lib:keyInteraction('hide')

-- key-interaction state
-- isOpen: boolean state
-- options: given table for the keyInteraction show
local isOpen, options = exports.lvs_lib:keyInteraction('isOpen')


```

***
