getscriptbytecode
Gets processed Luau bytecode for a script.
Syntax
getscriptbytecode(script: CoreScript | LocalScript | ModuleScript | Script) -> stringParameters
| Parameter | Type | Description |
|---|---|---|
script | CoreScript, LocalScript, ModuleScript, or client Script | The script |
Returns
| Type | Description |
|---|---|
string | Binary Luau bytecode |
Description
getscriptbytecode returns the bytecode associated with the script. It does not return source text.
Example
local module = getloadedmodules()[1]
if module then
local bytecode = getscriptbytecode(module)
print("Bytecode length:", #bytecode)
writefile("module-bytecode.bin", bytecode)
endNotes
- If Volt cannot retrieve bytecode, the function raises an error
- Luau strings preserve embedded null bytes in the returned data
- Use
decompile(script)when you need source text rather than interpreting this payload directly
Related Functions
getscripthash- Get a hash of the same bytecodegetscriptclosure- Get the script's function
Aliases
dumpstring