getscriptbytecode
Gets the compiled bytecode of a script.
Syntax
getscriptbytecode(script: LocalScript | ModuleScript) -> stringParameters
| Parameter | Type | Description |
|---|---|---|
script | LocalScript or ModuleScript | The script |
Returns
| Type | Description |
|---|---|
string | The compiled Luau bytecode |
Description
getscriptbytecode extracts the compiled bytecode from a script. This can be used for analysis or decompilation.
Example
local scripts = getrunningscripts()
if #scripts > 0 then
local bytecode = getscriptbytecode(scripts[1])
print("Bytecode length:", #bytecode)
-- Save to file for analysis
writefile("script_bytecode.bin", bytecode)
endNotes
- Bytecode is in compiled Luau format
- Can be decompiled with appropriate tools
- Useful for script analysis and research
Related Functions
getscripthash- Get a hash of the bytecodegetscriptclosure- Get the script's function
Aliases
dumpstring