Skip to main content
Reads the file at path, compiles it as Luau, and returns the resulting chunk as a function. The function is not called yet - invoke it yourself when you’re ready to run the code.
path is relative to Seliware’s workspace folder.

Parameters

Returns

(function, nil) on success, (nil, string) on failure. Always check the second return before invoking the first.

Example

Cache a helper function via loadfile() so you can re-call it without re-reading the file:
Compiles the script but does not execute it until the returned function is called.