load
Alias of loadstring.
Syntax
load(source: string, chunkName?: string) -> function
Parameters
| Parameter | Type | Description |
|---|---|---|
source | string | Luau source code to compile or execute. |
chunkName? | string | The chunk name value used by the call. |
Returns
| Type | Description |
|---|---|
function | The returned function. |
Description
load is part of the Scripts & decompiling library. Script helpers inspect scripts in the live DataModel and can read bytecode or decompile source.
Each call creates or returns a fresh object or value that you can store and pass to other functions.
Example
local fn = load("return 2 + 2", "chunk")
print(fn())
Notes
- Script bytecode and source are read from the live game.