@rbxts/proton
Version:
Framework for Roblox game development
37 lines (36 loc) • 1.21 kB
TypeScript
/// <reference types="@rbxts/types" />
export declare namespace ProtonUtil {
/**
* Load Mode for `ProtonUtil.loadModules()` function.
*/
enum LoadMode {
/**
* Only iterate over direct children instances.
*/
Children = 0,
/**
* Iterate over all descendant instances.
*/
Descendants = 1
}
/**
* Load all modules within the parent of the calling script.
* An optional `matchName` and `loadMode` can be provided
* to help dictate the load behavior.
*
* ```ts
* // Load all children ModuleScripts
* ProtonUtil.loadModules();
*
* // Load all descendant ModuleScripts
* ProtonUtil.loadModules(undefined, ProtonUtil.LoadMode.Descendants);
*
* // Load all ModuleScripts that end with '-service'
* ProtonUtil.loadModules("%-service$", ProtonUtil.LoadMode.Descendants);
* ```
*
* @param matchName Only load ModuleScripts that match the given pattern
* @param loadMode LoadMode enum to indicate scanning direct children or all descendants
*/
function loadModules(parent: Instance, matchName?: string, loadMode?: LoadMode): void;
}