Warning
This is a very new project, fresh out of the womb. You may encounter bugs. Please report any bugs or issues by creating an issue here!
An open-source, high-performance and lightweight disassembler for Roblox Luau Bytecode V6 & V5. Made for Luau, written in Luau. Supports both Roblox specific bytecode & vanilla Luau bytecode!
Example.luau can be disassembled in around 0.00005827s while producing a readable and highly detailed output!
Disassembler.Disassemble(Bytecode, IsFromRoblox)
Returns a table containing the disassembled information about the passed bytecode.
Bytecode(string): A string containing raw Luau bytecode.IsFromRoblox(boolean): A boolean that determines if your bytecode is from vanilla Luau or from the bytecode of Roblox scripts. This is required as Roblox encodes opcode bytes in a different way compared to vanilla Luau.
MainProto(table): A table representing the main function prototype of the script. It contains detailed information like line numbers, parameters, and its own set of instructions and constants. You can refer toProtosunderneath for the structure of this table.Protos(table): An array of all function prototypes found in the bytecode, including the main one and any nested functions. Each prototype table contains:ProtoIndex(number): The index of the prototype.LineDefined(number): The line number where the function is defined in the source code.Source(string): The debug source name of the prototype.NumParams(number): The number of parameters the function accepts.IsVarArg(boolean): Whether the function is variadic (accepts...).MaxStackSize(number): The maximum number of registers used by the function.Instructions(table): An array of the raw instruction data for the prototype.Constants(table): An array of constants used by this prototype.Protos(table): An array of nested function prototypes.
ProtoCount(number): The total number of function prototypes found.LuauVersion(number): The version of the Luau bytecode (e.g., 5 or 6).TypesVersion(number): The version of the type information embedded in the bytecode.StringTable(table): An array of all unique strings found in the bytecode, which are referenced by index in constants and other parts of the prototypes.
local disassembler = require(path.to.disassembler)
local bytecode = whateverMagicalFunctionThatReturnsRawLuauBytecodeAsString()
local result = disassembler.Disassemble(bytecode)
print("Luau version of disassembled bytecode:", result.LuauVersion)Disassembler.FancyDisassemble(Bytecode, ShoveIntoOneString, IsFromRoblox)
Parses the passed bytecode with Disassembler.Disassemble to either print each instruction as it disassembles the bytecode, or return a massive string containing the whole disassembly output. The image at the start of this file is an example of Disassembler.FancyDisassemble used on Example.luau!
Bytecode(string): A string containing raw Luau bytecode.ShoveIntoOneString(boolean): A boolean value that determines if the function should return a massive string containing the whole disassembly output, or print each instruction as it disassembles.IsFromRoblox(boolean): A boolean that determines if your bytecode is from vanilla Luau or from the bytecode of Roblox scripts. This is required as Roblox encodes opcode bytes in a different way compared to vanilla Luau.
local disassembler = require(path.to.disassembler)
local bytecode = whateverMagicalFunctionThatReturnsRawLuauBytecodeAsString()
local result = disassembler.FancyDisassemble(bytecode, true)
return result