> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nuviod.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Examples & API Reference

> nv-interactions provides a lightweight system for registering context-based interactions.

## Overview

```lua theme={"dark"}
local groupKey = exports['nv-interactions']:AddInteraction(data, options, details)
```

## Return Value

| Name     | Type   | Description |                                                                        |
| -------- | ------ | ----------- | ---------------------------------------------------------------------- |
| groupKey | string | false       | Unique identifier for the interaction group. Returns false on failure. |

## Parameters

### data

| Field | Type   | Required | Description           |
| ----- | ------ | -------- | --------------------- |
| name  | string | Yes      | Display name in menu  |
| key   | string | Yes      | Keyboard key          |
| type  | string | Yes      | coord, entity, 3dtext |

### options

| Field       | Type     | Required | Description             |
| ----------- | -------- | -------- | ----------------------- |
| text        | string   | Yes      | Option label            |
| icon        | string   | No       | FontAwesome icon        |
| distance    | number   | Yes      | Interaction distance    |
| dotdistance | number   | No       | Dot visibility distance |
| disabled    | boolean  | No       | Disable option          |
| onselected  | function | No       | Callback                |
| event       | string   | No       | Client event            |

### details

| Type       | Description          |
| ---------- | -------------------- |
| vector3    | Single coordinate    |
| vector3\[] | Multiple coordinates |
| number     | Entity id            |

## Interaction State Management

### Disable Interaction

```lua theme={"dark"}
exports['nv-interactions']:DisableInteraction('coord', groupKey)
```

### Enable Interaction

```lua theme={"dark"}
exports['nv-interactions']:EnableInteraction('coord', groupKey)
```

## Edit Interaction

```lua theme={"dark"}
exports['nv-interactions']:EditInteraction('coord', groupKey, {
  name = 'Updated Interaction',
  key = 'F',
})
```

## Examples

### Single Coordinate

```lua theme={"dark"}
exports['nv-interactions']:AddInteraction({
  name = 'Test Interaction',
  key = 'E',
  type = 'coord',
}, {
  {
    text = 'Test Option',
    distance = 2.0,
    onselected = function()
      print('Selected')
    end
  }
}, vec(1.0, 1.0, 1.0))
```

### Multiple Coordinates

```lua theme={"dark"}
exports['nv-interactions']:AddInteraction({
  name = 'Multiple Locations',
  key = 'E',
  type = 'coord',
}, {
  {
    text = 'Interact',
    distance = 2.0,
  }
}, {
  vec(1.0,1.0,1.0),
  vec(2.0,2.0,2.0)
})
```

### Entity Interaction

```lua theme={"dark"}
exports['nv-interactions']:AddInteraction({
  name = 'Entity Interaction',
  key = 'E',
  type = 'entity',
}, {
  {
    text = 'Talk',
    distance = 2.0,
  }
}, entityId)
```

### 3D Text Interaction

```lua theme={"dark"}
exports['nv-interactions']:AddInteraction({
  name = '3D Text',
  type = '3dtext',
}, {
  {
    text = 'Read',
    distance = 2.0,
  }
}, vec(10.0,10.0,10.0))
```
