I made a function that takes a directory and converts them into table as strings. If it is a folder, it will use the function itself inside, if it is a ModuleScript, it will require it.
local function generateTable(moduleScript: ModuleScript, directory: Instance, depth: number)
local result = "{"
for _, object in directory:GetChildren() do
if not (object:IsA("Folder") or object:IsA("ModuleScript"))then
continue
end
result ..= ("\n%s[%q] = "):format(("\t"):rep(depth), object.Name)
if object:IsA("Folder") or object:IsA("Configuration") then
result ..= generateTable(moduleScript, object, depth + 1)
result ..= `\n{("\t"):rep(depth)}};`
else
result ..= `require({generatePath(moduleScript, object)});`
end
end
return result
end
After seeing this, I got reminded of me making something like and made a plugin, you can insert my plugin and check the TableGeneration module: Module Tracker Plugin - Easily Create Dictionaries of Modules
I do not know if I am not allowed to answer you this way and if this is seen as advertisement, if it is so then please tell me. I will remove it.