> For the complete documentation index, see [llms.txt](https://lt-studios.gitbook.io/lt-studios/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lt-studios.gitbook.io/lt-studios/assets/editor/user-guide/how-to-edit-create-menus/manual-configuration/creating-new-data-fields.md).

# Creating new Data Fields

### ⚠️ Note

If you’re ever unsure about a step in this guide, it’s better to pause and ask for clarification than to push ahead and risk breaking your setup. Take your time—getting it right the first time saves you troubleshooting later.

### Attributes

All getter functions live in **`server/utils.lua`** under the `Attributes` table. To display a new piece of data in your menus, add a function here that returns the value you want (Even state bags):

**Example**

```lua
Attributes = {
  -- Other Attributes...

  radio = function(player)
    local radioChannel = Player(player.source).state.radioChannel or 0
    if radioChannel == 0 then
      return "OFF"
    else
      return radioChannel
    end
  end,
}
```

### Events

Similarly, event handlers go in **`server/utils.lua`** under the `Events` table. Use these to react when a field is changed:

**Example**

```lua
Events = {
  -- Other Attributes...
  
  radio = {
    type = 'server',
    name = 'pma-voice:setPlayerRadio',
    func = function(player, channel)
      Player(player.source).state.radioChannel = channel
    end
  },
}
```

### Setting the data field to an existing menu

Simply go to the menu you'd like the new data field to display onto, and stick it in the **data**, **getters**, **events** and **anchors** tables as you'd like.

**Example**

<pre class="language-lua"><code class="lang-lua"><strong>data = {
</strong>  [1] = 'name',
  [2] = 'radio',
},
getters = {
  [1] = Attributes.name,
  [2] = Attributes.radio,
},
events = {
  [1] = Events.name,
  [2] = Events.radio,
},
anchors = {
  [1] = "left",
  [2] = "right",
},
</code></pre>
