This is a dictionary not a table. I’m not sure how this would be a reason for memory leaks? A memory leak is caused from losing a reference to something without cleaning it up like a connection(disconnect exist for a reason). Having a refence to something that is no longer needed can also be a memory leak due to it not being garbage collected.
It’s not bad practice to have access to all the modules in 1 script because it’s easy for communication reasons.
Although you could manage them easier and require them via a loop so you don’t have to manually type them all in every time.
I think throwing folders into dictionary is a little redundant though… modules could be useful in a dictionary for referencing purpose. Most frameworks use 1 script with many modules.
So you’re saying, that something like this would be better so I could add easily without editing every script?
function g:ReturnServer(): {ModuleScript}
local modules = {}
for _,module in ipairs(ServerStorage.Modules) do
table.insert(modules, module)
end
return modules
end
This is not bad practice, and this should be moved to a personal module script so you can access these variables from other scripts without having to define them from other scripts.