ModulesOnRails
ModulesOnRails.lua V1.1.0
Modules On Rails is a ModuleScript loader that allows you to load modules from a list of ancestors from just their name. It is a replcement for the traditional require() function. This module is intended to be utilized with VSCode, RobloxLSP, and a VSCode linting plugin.
ModulesOnRails has a method called GenerateImporter that takes a list of ancestors and an optional config table. It will return a function that can be used to import modules that are descendants of the list of ancestors. The modules availible can be filtered by setting various values in the config table. The current supported systems are:
USAGE: Below is some example code that shows how to utilize ModulesOnRails to generate an Importer module. The Second Block of code shows how to use the Importer module.
Import.lua
return ModulesOnRails.GenerateImporter({
game:GetService("ReplicatedStorage").SharedModules;
game:GetService("ServerScriptService").ServerModules;
})
local Import = require(game:GetService("ReplicatedStorage").Import)
local MyModule = Import("MyModule")
local Promise = Import("Promise")
local BuildingService = Import("BuildingService")
-- Once imported, any module can be used to same as if it was required.
MyModule.DoThing()