O que é o formato de ficheiro LUAU?
Um arquivo .luau contém código-fonte escrito em Luau, a linguagem de script que a Roblox derivou do .lua (Lua 5.1). A Roblox Corporation enviou o Luau aos desenvolvedores pela primeira vez em 2019 e o lançou como código aberto sob a Licença MIT em 2021. O arquivo é texto simples em UTF-8, portanto, qualquer editor pode lê-lo.
O Luau mantém a compatibilidade com o Lua 5.1 enquanto adiciona um sistema de tipos graduais, inferência de tipos, interpolação de strings e sandboxing. Dentro do Roblox Studio, cada Script, LocalScript e ModuleScript é salvo no disco como um arquivo .luau. A extensão separada permite que editores e linters reconheçam a sintaxe Luau em vez de tratá-la como Lua comum. Além da Roblox, estúdios como Remedy e Digital Extremes incorporam o Luau em seus próprios motores de jogo, então você pode encontrar arquivos .luau fora do mundo Roblox também.
Segurança e proteção
RISCO: MEDIUMA .luau file is plain-text source code and cannot run on its own; it only executes inside Roblox, the luau runtime, or another host that embeds Luau. Like any script, code from an untrusted source can perform unwanted actions when run, and the Roblox community has seen malicious model scripts (backdoors) shipped inside shared assets. Read the source before running it, and be cautious with obfuscated or copy-pasted scripts.
Detalhes do formato
em resumoProgramas que abrem arquivos LUAU
.luau on disk. .luau file directly; install the Luau Language Server extension for syntax highlighting, type checking, and autocomplete. luau script.luau in a terminal to execute the file, or luau-analyze script.luau to type-check and lint it. .luau files. .luau file; add the Luau Language Server extension for full language support. luau script.luau or analyze it with luau-analyze script.luau from Terminal. .luau file and install the Luau Language Server extension for highlighting and diagnostics. luau script.luau to execute or luau-analyze script.luau to check the file. .luau; edit them in the browser-linked Studio environment. Detalhes técnicos
especificação profunda| Encoding | UTF-8 plain text (ASCII-compatible) |
| Byte order | N/A (text, no multibyte header) |
| Container | None; flat source file |
| Typical size | A few hundred bytes to tens of kilobytes |
| Structure | Human-readable Luau source code. May start with an optional mode directive comment (--!strict, --!nonstrict, or --!nocheck), followed by statements, function and type definitions. Type annotations on variables, parameters and return values are optional. |
| Integrity | None built in |
| Platforms | Windows, macOS, Linux, Web (Roblox platform) |
| Language Derived From | Lua 5.1 |
| Type System | Gradual, structural type inference (opt-in annotations) |
| Runtime | C++ Luau VM with rewritten interpreter, incremental garbage collector, and native x64/ARM64 code generation |
| Line Terminator | LF or CRLF |
| Notes | Luau is backward compatible with Lua 5.1 source, so many .luau files also run under a plain Lua 5.1 interpreter unless they use Luau-only syntax such as type annotations, string interpolation, or the continue keyword. |
| Lançado | 2019 |
| Versão mais recente | N/A (rolling releases; no versioned file format) |
| Padrão aberto | Sim · livre de royalties |
| Especificação | luau.org |
Conversões de LUAU
Perguntas e Respostas da Comunidade
perguntado por usuáriosAinda não há perguntas - seja o primeiro a perguntar sobre arquivos LUAU.
Perguntas frequentes
O que é um arquivo .luau?
Como faço para abrir um arquivo .luau?
luau.Qual é a diferença entre .luau e .lua?
.luau marca arquivos escritos para o dialeto Luau da Roblox, que adiciona anotações de tipo e outros recursos. O Roblox Studio salva seus scripts como .luau, enquanto o .lua é usado pelo Lua padrão e exportações antigas da Roblox.Posso executar um arquivo .luau fora da Roblox?
luau de código aberto nos lançamentos do GitHub do projeto e execute luau seu-arquivo.luau. Scripts que chamam APIs específicas da Roblox não funcionarão fora do motor Roblox.