of     1   

Hedr0n
#182313649Sunday, January 24, 2016 4:38 PM GMT

Cool system that I like to use because I think it's easier than pathing to each module I want to require. Of corse you can build onto this to knock out duplicates or even hook up more use for Remotes and bindables. Fun fun function CallOnChildren(Container, Function) Function(Instance) local Children = Container:GetChildren() for _, Child in next, Children do Function(Child) end end local Cache = {} CallOnChildren(game:GetService('ReplicatedStorage').YourRepo, function(Child) if Child:IsA'ModuleScript' then Cache[Child.Name] = Child end end) function Retrieve(Lib) return require(Cache[Lib]) or error('Could not find library "' .. Lib .. '".' end
128Gigabytes
#182313896Sunday, January 24, 2016 4:43 PM GMT

I don't get what you are trying to do
Soybeen
#182313929Sunday, January 24, 2016 4:44 PM GMT

would you adapt this to check if that Child was a StringValue and then LoadString it instead?
Hedr0n
#182313985Sunday, January 24, 2016 4:44 PM GMT

It's just something you can use if you use large amounts of modules like me. Pretty much it's use age is as follows: local NeededModule = Retrieve(ModuleName)
Hedr0n
#182314408Sunday, January 24, 2016 4:52 PM GMT

Cool system that I like to use because I think it's easier than pathing to each module I want to require. Of corse you can build onto this to knock out duplicates or even hook up more use for Remotes and bindables. Fun fun function CallOnChildren(Container, Function) Function(Instance) local Children = Container:GetChildren() for _, Child in next, Children do Function(Child) end end local Cache = { Modules = {}, Chunks = {} } CallOnChildren(game:GetService('ReplicatedStorage').YourRepo, function(Child) if Child:IsA'ModuleScript' then Cache.Modules[Child.Name] = Child elseif Child:IsA'StringValue' then Cache.Chunks[Child.Name] = Child.Value end end) function Retrieve(Lib) return require(Cache.Modules[Lib]) or error('Could not find library "' .. Lib .. '".' end function GetChunk(ChunkName) return Cache.Chunks[ChunkName] or error('Not a valid chunk name "' .. ChunkName .. '".') end
Hedr0n
#182314519Sunday, January 24, 2016 4:54 PM GMT

Lol whoops, double pasted the forum body. Soybean that's a slightly modified version of the op's that gets a string and gives it to whoever calls GetChunk. This has some major security vun tho
128Gigabytes
#182314530Sunday, January 24, 2016 4:54 PM GMT

Seems a bit overly complicated local modules = {} local function getModules(instance) if (instance:isA("ModuleScript")) then modules[instance.Name] = instance --[[Or switch to require(instance)]] end for _, child in next, (instance:getChildren()) do getModules(child) end return (nil); end getModules(game:getService("ReplicatedStorage").repo)
Hedr0n
#182314588Sunday, January 24, 2016 4:55 PM GMT

Why not cache it instead of calling all those loops every time you need to require a module.
128Gigabytes
#182314988Sunday, January 24, 2016 5:02 PM GMT

You don't need to call the function more than once Just use catch.ModuleName

    of     1