What is the LUA file format?
A .lua file contains a program or application extension source code, typically for a game or embedded application, written in the Lua scripting language. Source code is a collection of commands, instructions, and variable definitions written using a defined syntax. .lua is a plain-text file that can be opened and edited with any text editor; however, it is advised that such files be opened in editing tools that support syntax highlighting. A .lua file can contain a number of short commands, as well as a complete program or module code.
Lua syntax draws inspiration from Pascal, and the language uses associative arrays (called *tables*) and extensible semantics via metatables. Lua is described by its developers as:
- Robust and tested - used by many acclaimed developers and projects, including Adobe Lightroom plugins, Wikipedia's Scribunto templating system, CCTV and embedded firmware, and games such as World of Warcraft (UI addons) and the original Angry Birds.
- Fast - widely regarded as the fastest interpreted scripting language; LuaJIT, its just-in-time compiled variant, extends performance even further.
- Cross-platform - Lua is distributed as platform-independent ANSI C source, running on Linux, Windows, macOS, Android, iOS, embedded systems, and mainframe computers.
- Embeddable - well-documented and easy to integrate via its C API with code written in other languages, both compiled and scripting.
- Simple and powerful - offers support for meta-features (metatables and metamethods) that can be extended as needed.
- Lightweight and free - the interpreter adds roughly 300 KB to an application, and the language is released under the MIT licence.
Lua was created in 1993 by computer engineers Roberto Ierusalimschy, Waldemar Celes, and Luiz Henrique de Figueiredo at the Pontifical Catholic University of Rio de Janeiro (PUC-Rio). It is maintained by the LabLua research laboratory within that university's Computer Science Department. "Lua" means 'moon' in Portuguese. Multiple versions of the language have been developed since its creation; the current stable release is Lua 5.4, introduced in 2020, which brought a new generational garbage collector and a distinct integer subtype. Pre-compiled Lua bytecode is stored in .LUAC files and carries a binary \x1BLua magic header rather than readable text.
Security & safety
RISK: MEDIUMA .lua file is source CODE, so reading it is safe but RUNNING an untrusted one is not: Lua scripts can call os.execute, io.open, os.remove and load native libraries, so a malicious script can delete files, exfiltrate data or run system commands - exactly how some game-cheat and "free script" .lua files attack users. Always read a downloaded .lua before running it, get game addons/mods only from reputable sources, and be wary of obfuscated or bytecode (.luac) scripts you can't inspect. Inside a sandboxed host (e.g. Roblox) the risk is lower but social-engineering 'scripts' are still a common scam vector.
Format details
in a nutshellPrograms that open LUA files
Technical details
deep spec| File type | Plain-text source code (UTF-8 or ASCII) |
| MIME type | text/x-lua |
| File signature (magic bytes) | None for source files - plain text with no binary header. Pre-compiled bytecode uses 1B 4C 75 61 (ESC + "Lua") |
| Syntax paradigm | Multi-paradigm: procedural, object-oriented via metatables, and functional |
| Core data structure | Table (associative array) - the sole compound type, serving as arrays, dictionaries, and objects |
| Comment syntax | -- for single-line; --[[ ... --]] for block comments |
| Shebang support | Source file may begin with #!/usr/bin/env lua for direct execution on Unix-like systems |
| Standard runtime | lua (interpreter), luac (bytecode compiler), luajit (JIT compiler) |
| Host embedding API | Compact C API (lua_State, luaL_newstate, lua_call); bindings available for C++, Python, Java, and others |
| Standard library | io, os, string, table, math, coroutine, package, utf8, debug - minimal footprint by design |
| Coroutine support | First-class asymmetric coroutines via coroutine.create / coroutine.resume / coroutine.yield |
| Garbage collector | Incremental tri-color mark-and-sweep; optional generational mode introduced in Lua 5.4 |
| Numeric types | Distinct integer (64-bit by default) and float (double-precision) subtypes since Lua 5.3 |
| Module system | require() resolves .lua source and binary C extensions (.so / .dll) via package.path / package.cpath |
| Licence | MIT licence (open source, free for any use including commercial) |
| Released | Lua created in 1993 at PUC-Rio (Pontifical Catholic University of Rio de Janeiro) |
| Open standard | Yes · royalty-free |
| Specification | www.lua.org |
LUA conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about LUA files.