0

This question seems to have been asked a few times, but I haven't found a clear/useful answer... I am rather new to coding. Anyways, I am looking at a game's code in Lua bytecode (I think) and am wondering if there is a way to convert it into readable code.

'bytecode' excample(so someone can identify it and better help me):

loadstring("\27\76\117\97\81\0\1\4\4\4\8\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\68

Thanks!

H Saruman
  • 17
  • 1
  • 1
  • 2
  • 1
    This is probable Lua 5.1 bytecode. You can save it to a file and run `luac -l` on it to see its contents. Converting it to Lua source code is not trivial. There are some tools that do a partial job, such as luadec, I guess. – lhf May 14 '18 at 00:30
  • 1
    Possible duplicate of [Best tool(s) for decompiling Lua bytecode?](https://stackoverflow.com/questions/743684/best-tools-for-decompiling-lua-bytecode) – Dimitry May 15 '18 at 10:33

1 Answers1

1

You can use luadec51 tool for decompiling lua versions 5.1.x.

Download release file from here and run the command:
Luadec51 compiled_script.lua(c) > decompiled_new_file.lua

It'll decompile the lua(c) file into a readable text file.


Note: there's also a fork of luadec51 to decompile lua 5.1 , 5.2 and 5.3: https://github.com/viruscamp/luadec but as of now there's no binary so you have to compile it first to make it work.


source: http://lua-users.org/wiki/LuaTools


Update: I found a tool for compiling/decompiling/comparing lua files: LuaTool 1.2 - Lua Decompiler, Compiler and Compare

GorvGoyl
  • 42,508
  • 29
  • 229
  • 225