I’ve made a framework template to easily setup a framework for your games.
This comes with a few modules already in it, such as Observers, Timer, Signal, and Trove.
HOW TO USE:
Requiring The Module
require the module with the path you put the module in.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Framework = require(ReplicatedStorage:WaitForChild("Framework"))
Get The Loaded Modules
get the modules the framework loads for you.
Server:
local Server = Framework["Server"]
local Shared = Framework["Shared"]
local Observers = Framework["Observers"]
Client:
local Client = Framework["Client"]
local Shared = Framework["Shared"]
local Observers = Framework["Observers"]
Get A Module Within The Framework
retrieve a module that the framework loaded.
--> Server [Server, Shared]
local Module = Server["ModuleName"] --> First Way
local Module = Framework:get("ModuleName") --> Second Way
--> Client [Client, Shared]
local Module = Client["ModuleName"] --> First Way
local Module = Framework:get("ModuleName") --> Second Way
Initialize All Modules
Initialize All Your Modules (Besides The Modules In “Shared”).
This will call the “Init” or “Initialize” function in any module that has one in the Server Folder or Client Folder.
--[[
Server: Initializes all server modules
Client: Initializes all client modules
]]--
Framework:Initialize("ModuleName")
--[[
You do not need the ModuleName passed through,
If you call Framework:Initialize() or Framework:Initialize("") it will initialize every module,
If you call Framework:Initialize("ModuleName") it will initialize that single module.
]]--
MODEL:
Includes an example for the server and the client.
CONCLUSION:
Any feedback or criticism is appreciated!
I hope this helps some of you!