Dependencies

Adding dependencies to your singleton is a piece-of-cake with the new version, as you can use Roblox's vanilla require function:

local OtherService = require(script.Parent.OtherService)

local Service = Quebec.singleton({})

-- ...

The only rule is: You must require all dependencies BEFORE you call Quebec.singleton because that function registers your singleton in a table. By requiring other services before that, it makes sure that they have a higher index in the list than the service that depends on them.

After requiring another service, you can use all of their functions like in a regular ModuleScript.

Last updated