loadfile
Compiles a file into a function with the Luau compatibility pass. Returns nil, message on failure.
Syntax
loadfile(path: string) -> function
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | A path inside the Yuari workspace. |
Returns
| Type | Description |
|---|---|
function | Nil, message on failure |
Description
loadfile is part of the File system library. File functions are sandboxed to the executor workspace; paths outside it are rejected.
Each call creates or returns a fresh object or value that you can store and pass to other functions.
Example
local fn = loadfile("script.lua")
if fn then fn() end
Notes
- Paths are sandboxed to the executor workspace.