Introducing Modules, a simple dependency loader for Roblox!
Quick Start – What does it do?
Modules wraps the built-in require
function. This lets you use a string to find your modules intelligently – while also retaining all its existing functionality!
-- Overwrite require to get a bunch of cool features:
local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Modules"))
-- Searches for namespace "MyNamespace", then for module "MyModule":
local MyModule = require("MyNamespace:MyModule")
-- Requires the module at:
-- ServerScriptService.MyNamespace.MyModule
-- or ReplicatedStorage.MyNamespace.MyModule
-- You can also use a built-in module like this:
local Event = require("Event")
Modules uses namespaces to look for code. This is just a Folder in ReplicatedStorage or ServerScriptService.
Check out the Getting Started guide →
Features
Some Batteries Included: A few commonly-used utilities and patterns are built-in: class, Event, Maid, StateMachine. These can be required using require("Event")
, etc!
Sharing is Caring: In shared modules, require.server(...
) and require.client(...)
allow you to skip requires if not on a certain network peer.
Easy to Package: With Modules, you can bundle server and client code simply into a single Folder (the namespace) in ServerScriptService, then put client code in a “Replicated” folder. It’s great for Roblox packages!
Download
Version | Download | Model | Changes |
---|---|---|---|
latest | ↓ 36.7 KB | Get | |
1.1.1 | ↓ 36.7 KB | Get | Linting |
1.1.0 | ↓ 36.7 KB | Get | Exclude tests |
1.0.0 | ↓ 48.8 KB | Get | Initial release |
Docs: docs.ozzypig.com/Modules
Modules is fully documented from doc comments in-code! You can read these directly in Roblox Studio, or check out the documentation website which is built from these comments using a pretty involved toolchain. (.lua → LDoc → ldoc2mkdocs (custom Python tool) → MkDocs → .html)
GitHub: Ozzypig/Modules
The project is built using Rojo 0.5.4, although later versions will work as well
See also
- The announcement of Modules on my website, ozzypig.com →
- The announcement of Modules on my Twitter profile →
Feedback
In order of preference, here’s the ways I’d like your feedback on Modules:
- Create an issue on the GitHub repo →
- Send me a message on the Devforum →
- Contact me via my website, ozzypig.com/contact →
- Send me a message on Roblox →
- Reply to this thread (your post may get buried!)
Enjoy, and please let me know if you made something cool!