Any way to view corresponding bytecode for a function

Without string.dump is there any way at all to see a function in binary representation or raw bytes, and even decompile that if possible back to source code manually?

I need to view Lua source code compiled into bytecode , within Studio - despite the removal of string.dump.

I have no use-case for this, I’m just curious. I know it is possible to get the binary representation in pure Lua 5.2.
I’m expecting the answer to the question in title to be No, but I just needed to confirm whether there’s any partial solutions to this.

Unfortunately, no. All bytecode-related features were removed years ago, iirc to prevent some exploits or as a way to stop people from “obfuscating” scripts by compiling them.

You could get the bytecode by using string.dump in a standalone Lua installation. It exists in Lua 5.1, but this will be significantly different from the bytecode that Roblox would generate. Roblox have been making huge changes to their Lua interpreter behind the scenes, and it’s safe to say at this point that the Lua bytecode interpreter works nothing like it originally did.

You could use a version of the Lua compiler that was ported to run on Lua, but this is just a literal conversion of the normal Lua 5.1 compiler and would generate the same result.

2 Likes