outdated collection of modules and utilities used in my roblox game

Nim 96f5e3968f removed nTable 2 years ago
lib 96f5e3968f removed nTable 2 years ago
modules dc4fa7b0df updated dependancies 2 years ago
.gitmodules fa41e9f56e modules url fix 2 years ago
.luacheckrc 18ad0d0e5f applied newest roblox-luacheck 2 years ago
LICENSE f2d1b1b301 Created Repo 2 years ago
README.md d2127bdb99 nicer example formatting 2 years ago
rojo.json a7e0795ea9 added t to rojo partitions 2 years ago

README.md

PizzaAlpaca

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!

How to use

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.

Attribution

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