I Made a simple Module Loader It works great but i have an issue When i Get a module that was loaded through the module loader intellisense dosent recongize it and it dosent suggest me the functions/methods Im unsure how do i need to set it up to make it display all the functions/methods.
It’s difficult to say with the amount of context given. Would you mind showing me how your loader handles modules?
local ModuleLoader = {}
local rp = game:GetService("ReplicatedStorage")
local Modules = rp.Modules.LModules
local LoadedModules: { [string]: any } = {}
function ModuleLoader:Get(...): ...ModuleScript
local Return: { [number]: ModuleScript } = {}
for i, arg: string in ipairs({...}) do
if not LoadedModules[arg] then
local Module = Modules:FindFirstChild(arg) :: Instance
LoadedModules[arg] = require(Module)
end
Return[i] = LoadedModules[arg] :: ModuleScript
end
return table.unpack(Return)
end
return ModuleLoader
Here is my Module Loader
Using a separate loader to grab modules won’t give you any autocomplete functionality. Any sort of framework that works by using functions like :GetModule()
, :LoadModules()
or anything similar fall under that.
If you’re not requiring your modules directly, you won’t have any sort of autocomplete. It’s a known issue with frameworks in general.
isnt there a way to bypass it? for example using a diffrent IDE?
It’s a Luau fallacy, not a Studio one, so I wouldn’t imagine that using a separate IDE would help.
would you recommand keeping the module loader or just use normal requires?
Lots of module loaders have this issue. There could be a bypass, but you’d have to do a lot of hacky stuff to it. Take the Knit framework for example - you’d have to go through a process just to end up with something that isn’t Knit anymore.
Recently, my games’ framework just consists of a LocalScript/Script requiring modules in a Runtime folder, and the modules just require each other directly when needed.
Not saying it’s impossible to have intellisense with a module loader, but if you’re not willing to go the extra mile and prioritize intellisense over a stylized way of programming, then I recommend falling back to basic ModuleScript use.
ill prob have to go the extra mile unsure how tho
Just use normal requires. Module loaders are completely unnecessary.