Start typing to search packages!
loader
By @ldgerrits
Roblox
MirroredLoader
Loader is a service framework for the Roblox ecosystem.
Service Example
Services are simply tables with a name and a couple lifecycle methods.
local MyService = {}
function MyService.Init(self: MyService)
print("Initialized the service")
end
function MyService.Start(self: MyService)
print("Started")
end
return MyService
Services must be explicitly added into Loader via Loader:AddService(). Once all services are added, Loader:Start() will kick off the lifecycle methods of the services.
A script to bootstrap Loader might look like this:
local Loader = require(somewhere.Loader)
for _, module in ipairs(somewhere.MyServiceModules:GetChildren()) do
Loader:AddService(service)
end
Loader:Start()
Using multiple services
Because services are just tables, it is easy for one service to use another. Simply get a reference to the other service (e.g. requiring its ModuleScript) and then access it after Start has fired. For example:
local MyService = require(somewhere.MyService) -- Grab the other service
local AnotherService = {}
function AnotherService.Init(self: AnotherService)
-- Other services are NOT safe to use here, because there's no guarantee
-- that they have all been initialized yet. Wait until Start.
end
function AnotherService.Start(self: AnotherService)
-- Other services are safe to use once the Start method fires.
MyService:DoSomething()
end
Memory categories
Because Loader services are started from one source, the default memory label within the Developer Console will appear the same for all services. To solve this, Loader will automatically assign a memory category based on the service's name.
When MyService is initialized/started, any memory usage will show up within the MyService label in the Developer Console memory section.
Package Details
Install command (Click to copy)
Version
1.0.1
License
MIT
Safe for commercial use
The package archive does not include its license text; the license is declared in its manifest metadata.
Automated license review — not legal advice.
