Loader
Loads command modules from a directory tree and supports hot-reload via file watching.
Summary
Properties
Section titled “Properties”registry
Section titled “registry” Loader.registry :: Registry
logger
Section titled “logger”context
Section titled “context” Loader.context :: any
Methods
Section titled “Methods”Loader : load ( directoryPath ) -> ()
Recursively loads all .luau command modules found under directoryPath.
Parameters
| directoryPath: string |
reload
Section titled “reload”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.
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
| () -> () |
Functions
Section titled “Functions”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 |