How to decompile a Lua file?

36.8k Views Asked by At

I have a lua file, which, when opened in Notepad++ shows a mixture of English (uncorrupted), understandable text, as well as a mixture of "NULS" "ETX's" and other strange symbols, before I delve into attempting to decompile this, I want to work out if it is even possible?

Any help appreciated, thanks.

2

There are 2 best solutions below

5
On BEST ANSWER

First bytes of the compiled Lua file tell the version where the script was compiled in.

Try LuaDec. (5.1 - 5.3) https://github.com/viruscamp/luadec

Alternative project: Chunkspy. (It's only for 5.1 and 5.0.2.) http://chunkspy.luaforge.net/

For 5.1 and 5.0: https://sourceforge.net/projects/unluac

3
On

You can try this online Lua decompiler tool I wrote.

It supports decompilation for all versions from Lua 5.1 to Lua 5.4, as well as for LuaJIT. Additionally, it allows you to view bytecode controlflow graph and its disassembly code.

In addition, it also supports loading custom parser to decompile unofficial lua bytecode files.