AcediaDocumentation

loadfile

Compiles a workspace file without executing it.

Returns nil and a reason when the file cannot be read or compiled. File input is limited to 64 MiB.

loadfile(path: string): (function?, string?)

Parameters

ParameterTypeDescription
pathstringPath relative to the Acedia workspace.

Example

writefile("example.lua", "return 42")
local callback, reason = loadfile("example.lua")
if callback then print(callback()) else warn(reason) end

Example output

42

Errors: Invalid argument types raise; read or syntax failures return nil and an error string.

Aliases: loadfileasync.

On this page