outdated collection of modules and utilities used in my roblox game
Nim 96f5e3968f removed nTable | 6 年之前 | |
---|---|---|
lib | 6 年之前 | |
modules | 6 年之前 | |
.gitmodules | 6 年之前 | |
.luacheckrc | 6 年之前 | |
LICENSE | 6 年之前 | |
README.md | 6 年之前 | |
rojo.json | 6 年之前 |
PizzaAlpaca is a bunch of modules and utilities used in a lot of my projects, and now it's available for you to gawk at in abject horror!
PizzaAlpaca comes with a ModuleManager utility object that can load modules, modules follow this structure
local Module = {}
function Module:Init(moduleManager) -- Not safe to invoke other modules, they may not have initialized yet.
-- Prepare your module to be invoked by other modules
end
function Module:Start(moduleManager) -- Safe to invoke other modules
local OtherModule = moduleManager:GetModule("OtherModule")
OtherModule:Foo()
end
return Module
The ModuleManager can be initialized simply
local PrintDebug = true
local ModuleManager = require(ReplicatedStorage.lib.object.ModuleManager).new(PrintDebug) -- Create new modulemanager with debug prints on
-- Adds all child modules in an instance to the loading queue. This is not recursive.
ModuleManager:AddModuleDirectory(ReplicatedStorage.modules)
-- You may also queue singular modules if you want
-- ModuleManager:AddModule(someModuleScript)
-- After all modules are added, load them, init them, then start them.
ModuleManager:LoadAllModules()
ModuleManager:InitAllModules()
ModuleManager:StartAllModules()
This style allows you to avoid circular dependancy problems you can get by just requireing.
This project uses Quenty's luacheck-roblox luacheck config. https://github.com/Quenty/luacheck-roblox
luacheck-roblox is licensed under the MIT license https://github.com/Quenty/luacheck-roblox/blob/master/LICENSE.md
This project uses Quenty's Maid object. https://github.com/Quenty/NevermoreEngine/blob/version2/Modules/Events/Maid.lua
This project uses Osyris' t typechecking module. https://github.com/osyrisrblx/t
t is licensed under the MIT license https://github.com/osyrisrblx/t/blob/master/LICENSE