Skip to content

Sparebola/node-luajit-decompiler-v2

 
 

Repository files navigation

LuaJIT Decompiler v2. Node support

LuaJIT Decompiler v2 is a replacement tool for the old and now mostly defunct python decompiler.
The project fixes all of the bugs and quirks the python decompiler had while also offering
full support for gotos and stripped bytecode including locals and upvalues.

Usage

It is recommended to run in a separate node thread

import { type DecompileOptions, decompile } from "node-luajit-decompiler-v2";

const options: DecompileOptions = {
  ignoreDebugInfo: false,
  minimizeDiffs: true,
  unrestrictedAscii: true,
};

try {
  const tmpInFile = "file.luac";
  const buffer = fs.readFileSync(tmpInFile);
  const result = decompile(buffer, options);
  fs.writeFileSync(tmpOutFile, result, "binary");
} catch (error) {
  console.error(error);
}

TODO

  • bytecode big endian support
  • improved decompilation logic for conditional assignments

Original project https://github.com/marsinator358/luajit-decompiler-v2

About

LuaJIT bytecode decompiler

Resources

License

Stars

Watchers

Forks

Contributors

Languages

  • C++ 97.5%
  • C 2.0%
  • Other 0.5%