> For the complete documentation index, see [llms.txt](https://docs.gamesense.biz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gamesense.biz/ru/api-reference/puti-menyu.md).

# Пути меню

Доступ к существующим настройкам и путям меню.

Функции `menu` умеют работать не только с элементами скрипта, но и с существующими настройками интерфейса.

## menu.paths

`menu.paths([prefix: string]): table`

Возвращает список доступных путей. Необязательный аргумент `prefix` ограничивает выборку путей.

```lua
local all_paths = menu.paths()
local misc_paths = menu.paths("Misc")
```

Фактические пути зависят от доступных элементов меню. Список допустимых путей предоставляется функцией `menu.paths()`.

## menu.exists

`menu.exists(path: string): boolean`

Проверяет, существует ли элемент с указанным путём.

## menu.get

`menu.get(path: string): any`

Возвращает значение найденной настройки. Тип результата зависит от типа элемента.

```lua
local path = menu.paths()[1]

if path and menu.exists(path) then
    local current_value = menu.get(path)
end
```

## menu.set

`menu.set(path: string, value: any)`

Меняет значение существующей настройки, если она допускает запись. Тип значения зависит от элемента: `boolean` для переключателя, `number` для числовой настройки, `{r, g, b, a}` для цвета.

## menu.rescan / menu.ready

`menu.rescan()` запрашивает обновление списка путей. `menu.ready(): boolean` показывает, завершено ли сканирование.

```lua
local status = menu.label("Menu paths: scanning")
local updated = false

menu.rescan()

register_callback("on_update", function()
    if updated or not menu.ready() then
        return
    end

    status:set("Menu paths: " .. #menu.paths())
    updated = true
end)
```

## menu.targets

`menu.targets(): table`

Возвращает список разделов меню, в которые можно поместить собственные элементы скрипта.

## menu.target

`menu.target([scope: string])`

Выбирает место для **следующих** создаваемых элементов. Вызов без аргументов возвращает размещение по умолчанию.

```lua
local targets = menu.targets()

if targets[1] then
    menu.target(targets[1])
    menu.checkbox("Extra option", false)
    menu.target()
end
```

Допустимые разделы определяются через `menu.targets()`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.gamesense.biz/ru/api-reference/puti-menyu.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
