Skip to content

function useModules view code

useModules(
    root: Root, 
    modules: { Instance }, 
    predicate: ((module: ModuleScript) -> boolean)?
): Root

Given an array of instances, requires all ModuleScripts and adds the returned provider to the root, if any. If the provider is unnamed, the provider is named after the ModuleScript name. An optional predicate function can be provided to filter the modules.

Parameters

root: Root

The root that should use the ModuleScripts.

modules: { Instance }

The given instances to require.

predicate: ((module: ModuleScript) -> boolean)?

An optional predicate function to filter the given modules.

Returns

Root

The same root for convenience.