explaingit

coldzer0/luadecompiler

12PascalAudience · developerComplexity · 3/5LicenseSetup · hard

TLDR

Converts compiled Lua bytecode files back into readable source code, supporting Lua 5.1 through 5.5 with disassembly, decompilation, and custom opcode table support for scripts obfuscated with modified instruction sets.

Mindmap

mindmap
  root((LuaDecompiler))
    Modes
      Disassembly
      Decompilation
      SSA dump
    Lua Versions
      5.1 through 5.5
    Features
      Custom opcode tables
      VSCode extension
      Validation tests
    Use Cases
      Game modding
      Script recovery
      Obfuscation bypass
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Decompile a compiled Lua script from a game or app back to readable source to understand how it works

USE CASE 2

Supply a custom opcode table to process Lua bytecode that was obfuscated with a modified instruction set

USE CASE 3

Disassemble a Lua bytecode file to inspect raw instructions when debugging a game mod or embedded script

USE CASE 4

Use the VSCode extension to open compiled Lua files directly in the editor with syntax highlighting

Tech stack

PascalLazarusPythonLua

Getting it running

Difficulty · hard Time to first run · 1h+

Requires Lazarus (free Pascal IDE) to build from source, Python and Lua are only needed for the validation test suite.

Free to use and modify, but if you distribute the software or run it as a network service, you must release your modified source code under the same AGPL-3.0 license.

In plain English

Lua is a programming language often embedded in games and applications, and when Lua code is distributed it is typically compiled into a binary format called bytecode, which is not human-readable. This tool, cLuaDecompiler, works in reverse: it takes those compiled Lua bytecode files and converts them back into readable Lua source code. It supports all major Lua versions from 5.1 through 5.5. The tool has two main modes. Disassembly shows the raw instruction-level content of the bytecode file, naming each operation and listing its operands. Decompilation goes further, reconstructing something close to the original Lua source code by analyzing how the instructions relate to each other. A third mode dumps an internal representation called SSA (Static Single Assignment form), which is useful for developers who want to understand or debug the decompiler's reasoning about control flow and variable lifetimes. One practical feature is support for custom opcode tables. Some applications modify Lua's standard instruction set to obfuscate their scripts, and this tool allows you to supply an alternative table so those modified bytecode files can still be processed. The README also mentions an optional Visual Studio Code extension that lets you open compiled Lua files directly in the editor, where they appear as readable source with syntax highlighting. Building it requires Lazarus, which is a free Pascal development environment, along with Python and the Lua toolchain if you want to run the included validation tests. The validation suite compiles test scripts, runs them under the original Lua interpreter, decompiles the resulting bytecode, runs the decompiled version, and then compares the output to confirm they match. The README notes that decompiled output should be treated as recovered source rather than an exact reconstruction. Variable names, formatting, and some structural details may differ from the original while still preserving the program's behavior. The project is licensed under the GNU AGPL version 3.

Copy-paste prompts

Prompt 1
Using cLuaDecompiler, help me decompile a Lua 5.4 bytecode file from a game mod. Walk me through the command-line syntax and explain what the decompiled output represents.
Prompt 2
The game I am reverse-engineering uses a modified Lua opcode table. Using cLuaDecompiler's custom opcode table feature, help me write a table configuration file for my modified instruction set.
Prompt 3
Using the disassembly mode in cLuaDecompiler, explain what each instruction in this Lua bytecode dump does and how to read the operand notation.
Prompt 4
Help me set up cLuaDecompiler with the VSCode extension on Windows so I can open and browse compiled Lua files directly in my editor with syntax highlighting.
Open on GitHub → Explain another repo

← coldzer0 on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.