Tool:Unluac
| Website | https://sourceforge.net/projects/unluac/ |
|---|---|
| On this wiki | Facts · Code · Notes · Topics |
unluac is a Java decompiler for Lua chunks; the SourceForge original handles Lua 5.1 with debug info intact, and forks extend it (for example a Playdate fork).
Overview
The project description in the README of the mirror at github.com/HansWessels/unluac says unluac is a decompiler for Lua 5.1 chunks made with the standard Lua compiler, and that it requires the debug information not to be stripped from the chunk (luac includes it by default). Run java -jar unluac.jar myfile.lua > out.lua.
A fork README (github.com/scratchminer/unluac) says it adapts unluac to the Playdate's Lua bytecode, with java -jar unluac.jar -o out.lua in.luac. The README title of the original says "LUA 5.x"; Unverified: which versions beyond 5.1 current releases handle (later releases are said to cover 5.2 to 5.4; check the release notes).
Failure modes
Stripped chunks (no local names or line info) lose names and make control-flow recovery harder. Unverified beyond the README: modified or custom-opcode Lua builds (common in games) fail until the opcode map is patched.
Related
Technique:Choosing a decompiler, Format:Lua bytecode.
Sources
- READMEs of the two repositories named above.