> For the complete documentation index, see [llms.txt](https://docs.perfectcs2.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.perfectcs2.com/referencia/bibliotecas.md).

# Bibliotecas do Lua

O que da biblioteca padrão do Lua está disponível.

Os scripts usam **Lua 5.4**. O manual oficial, em inglês, está em [lua.org/manual/5.4](https://www.lua.org/manual/5.4/).

| Biblioteca               | Disponível                                                                                                   |
| ------------------------ | ------------------------------------------------------------------------------------------------------------ |
| Funções básicas          | Todas, exceto `dofile` e `loadfile`. `load` aceita só texto. `print` e `warn` escrevem no Console do script. |
| `string`                 | Todas, exceto `string.dump`                                                                                  |
| `table`                  | Todas                                                                                                        |
| `math`                   | Todas                                                                                                        |
| `utf8`                   | Todas                                                                                                        |
| `coroutine`              | Todas                                                                                                        |
| `os`                     | Só `os.time`, `os.clock`, `os.date` e `os.difftime`                                                          |
| `io`, `package`, `debug` | Não estão disponíveis                                                                                        |

`require` existe, mas carrega só arquivos da pasta de scripts: veja [require](/documentacao/api/require.md).

## O que o Perfect acrescenta

| Global                   | Página                                                                                                            |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------- |
| `ui`                     | [ui](/documentacao/api/ui.md)                                                                                     |
| `render`                 | [render](/documentacao/api/render.md)                                                                             |
| `icons`                  | [icons](/documentacao/api/icons.md)                                                                               |
| `menu`                   | [menu](/documentacao/api/menu.md)                                                                                 |
| `input`                  | [input](/documentacao/api/input.md)                                                                               |
| `client`                 | [client](/documentacao/api/client.md)                                                                             |
| `globals`                | [globals](/documentacao/api/globals.md)                                                                           |
| `storage`                | [storage](/documentacao/api/storage.md)                                                                           |
| `script`                 | [script](/documentacao/api/script.md)                                                                             |
| `callbacks`              | [callbacks](/documentacao/callbacks.md)                                                                           |
| `events`                 | [events](/documentacao/events.md)                                                                                 |
| `entities`               | [entities](/documentacao/api/entities.md)                                                                         |
| `engine`                 | [engine](/documentacao/api/engine.md)                                                                             |
| `buttons`                | [create\_move](/documentacao/callbacks/create-move.md)                                                            |
| `color`, `vec3`, `utils` | [color](/documentacao/tipos/color.md), [vec3](/documentacao/tipos/vec3.md), [utils](/documentacao/tipos/utils.md) |

{% hint style="warning" %}
Evite usar esses nomes para as suas próprias variáveis globais, por exemplo `color = 5`, porque isso substitui a função do Perfect dentro do seu script. Prefira variáveis `local`.
{% endhint %}


---

# 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.perfectcs2.com/referencia/bibliotecas.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.
