Yuari
Documentation
Docs/File system/loadfile

loadfile

Compiles a file into a function with the Luau compatibility pass. Returns nil, message on failure.

Syntax

loadfile(path: string) -> function

Parameters

ParameterTypeDescription
pathstringA path inside the Yuari workspace.

Returns

TypeDescription
functionNil, 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.