Page 1 of 1

Lua Decompiler

PostPosted: 11 Feb 2015, 16:19
by Xander9009
This is pretty freaking useless at the moment, but you can drop a compiled lua file onto the exe and you'll get back a decompiled version. Will probably only work for DotP and not general Lua scripts (although general lua scripts already have tools, so that doesn't matter). Should we ever manage to mod 2015 (which seems unlikely at this point :( ), then it'll make decompiling the lol files ~1% easier.

I was curious today what it took to decompile them, and it turned out the method involved manually editing the file in a hex editor and the using the command prompt to run the file through the proper lua decompiler. This will do both of those things for you, saving a little unnecessary effort (with the added benefit of using a temporary file rather than actually altering the original, not that that's likely to matter).

The tool I wrote doesn't care about the extension, but I don't know if unluac does.

Re: Lua Decompiler

PostPosted: 20 Feb 2015, 14:07
by Tejahn
Thanks! I'll get a look at this later.

Re: Lua Decompiler

PostPosted: 29 Sep 2016, 13:45
by thefiremind
Since this will become more useful now that Magic Duels uses LOL files for card pools and cards, I downloaded the source files for luadec 2.2, modified them so that the different format flag is already taken care of, and recompiled with Visual Studio. The result is attached to this post.

I also included 2 batch files that simplify things a little bit. Put the LOL file you want to decompile in the same folder as luadec, then drag and drop it on loldec.bat. You'll obtain a TXT file with the decompiled contents. With LOL files that can't be correctly decompiled you can try with loldis.bat (which disassembles them), but the result will be very hard to understand.

Some Visual C++ runtime libraries may be required.