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

# Ambiente e Limites

Bibliotecas Lua, limites de execução e segurança.

Os scripts são executados em um ambiente Lua isolado, com limites de memória e tempo de execução.

## Bibliotecas disponíveis

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

A biblioteca `os` disponibiliza apenas `clock`, `time` e `difftime`. O único módulo permitido em `require` é `ffi`:

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

As bibliotecas padrão `io`, `debug` e `package` não estão disponíveis. `dofile` e `loadfile` estão desativados. `load` aceita apenas código Lua em texto, não bytecode.

## Limites padrão

| Recurso                  |  Limite |
| ------------------------ | ------: |
| Memória por script       |  64 MiB |
| Carregamento do script   | 1000 ms |
| Execução de um callback  |   50 ms |
| Tamanho do arquivo Lua   |   1 MiB |
| Callbacks registrados    |     256 |
| Controles de menu        |      64 |
| Tamanho de um buffer FFI |   1 MiB |

Erros ou limites de execução excedidos podem interromper um script.

## Arquivos de script

Os scripts locais ficam na pasta `Gamesense/Scripts`. Os arquivos devem ter a extensão `.lua` e não podem estar em subpastas.

## Scripts inseguros

A opção **Allow unsafe scripts** permite operações restritas com IL2CPP, incluindo alteração de campos e execução de métodos. Deve ser habilitada somente para scripts confiáveis.


---

# 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/pt-br/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.
