> 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/getting-started/runtime-limits.md).

# Среда выполнения и ограничения

Доступные Lua-библиотеки, ограничения среды и безопасность.

Lua-скрипты работают в изолированной среде с ограничениями на память и время выполнения.

## Доступные библиотеки

`base`, `coroutine`, `table`, `string`, `math`, `utf8`.

Из `os` доступны `clock`, `time`, `difftime`. Через `require` можно загрузить только `ffi`:

```lua
local ffi = require("ffi")
```

Обычные библиотеки `io`, `debug` и `package` недоступны. `dofile` и `loadfile` также отключены. `load` принимает текстовый Lua-код, но не bytecode.

## Лимиты по умолчанию

| Ресурс                |   Лимит |
| --------------------- | ------: |
| Память одного скрипта |  64 MiB |
| Загрузка скрипта      | 1000 ms |
| Один callback         |   50 ms |
| Размер Lua-файла      |   1 MiB |
| Количество callbacks  |     256 |
| Элементы меню         |      64 |
| Один FFI-буфер        |   1 MiB |

При превышении времени выполнения или ошибке скрипт может быть остановлен.

## Работа с файлами

Локальные скрипты размещаются в `Gamesense/Scripts`. Файлы должны иметь расширение `.lua` и находиться непосредственно в папке скриптов — вложенные директории не поддерживаются.

## Unsafe scripts

Настройка **Allow unsafe scripts** нужна для изменения игровых данных через IL2CPP и вызовов игровых методов. Настройку рекомендуется включать только для доверенных скриптов.


---

# 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/getting-started/runtime-limits.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.
