Skip to content

Loader

Loads command modules from a directory tree and supports hot-reload via file watching.

Loader.registry  :: Registry
Loader.logger  :: Logger
Loader.context  :: any
Loader : load ( directoryPath )  -> ()

Recursively loads all .luau command modules found under directoryPath.

Parameters

directoryPath: string
Loader : reload ( directoryPath name )  -> ()

Re-requires a command file by writing its content to a temp file, bypassing the module cache. The temporary file is deleted immediately after the require call.

Parameters

directoryPath: string
name: string
Loader : watch ( directoryPath )  -> () -> ()

Watches directoryPath recursively for file changes, reloading or unloading commands as needed. Returns a stop function that cancels all watchers.

Parameters

directoryPath: string

Returns

() -> ()
Loader . new ( registryInstance loggerInstance context )  -> Loader

Constructs a new loader bound to the given registry, logger, and optional context object.

Parameters

registryInstance: Registry
loggerInstance: Logger
context: any

Returns

Loader