Decompile Luac Page
The Ultimate Guide to Decompiling Luac: Recovering Lua Source Code From Compiled Bytecode
: Ensure you have the matching decompiler version and required runtimes (like Java for Unluac).
Many game engines (e.g., Roblox's Luau, or platforms using modified versions of Cocos2d-x) modify the standard Lua virtual machine. They change the bytecode instruction mapping (opcode scrambling) or add custom security layers. Standard decompilers cannot read these modified binaries without custom plugins or custom unpacking scripts. Top Tools to Decompile Luac Files
The standard Lua interpreter does not run source code directly. Instead, it parses the code into an optimized binary representation called . This bytecode is typically saved with a .luac or .lua extension. Compiling code into LUAC offers three main advantages: decompile luac
Use to inspect bytecode:
While the process can be straightforward, developers often implement anti-reverse engineering techniques to protect their code. Stripped Debug Information
A powerful Java-based decompiler known for its excellent performance with Lua 5.0 through 5.4. It is highly regarded for its accuracy in reconstructing complex control flows like loops and if-statements. The Ultimate Guide to Decompiling Luac: Recovering Lua
Before running the decompiler, you need to know which version of Lua created the bytecode.
Execute the decompiler from the command line, ensuring you have enough memory allocated for larger files:
Decompilation is rarely perfect. You should expect a few hurdles when looking at the output file: This bytecode is typically saved with a
Lua 5.4 added new opcodes ( OP_MMBIN , OP_MMBINI , etc.) for metamethod handling and a new constant table format. Decompilers have mostly caught up, but obfuscation tools are also evolving.
What (if any) are you getting when trying to read it? Do you know which Lua version it uses? Share public link
Lua bytecode is (e.g., 5.1, 5.2, 5.3, 5.4, LuaJIT). Decompilers must match the version.
Open the newly created decompiled.lua file in a text editor like VS Code or Notepad++.