Revert "Merge pull request #92 from JericoFX/dev"

This reverts commit d697317142, reversing
changes made to 7927927394.
This commit is contained in:
MrNewb committed 2025-05-13 00:23:01 -04:00
1 parent 2a5fa897a9
commit 1d0255185d
4 files changed
+63 -227

No files matched your search

+11 -34
View File
@@ -22,7 +22,7 @@ function Bridge.RegisterModule(moduleName, moduleTable)
end
Bridge[moduleName] = wrappedModule
_ENV[moduleName] = wrappedModule -- Add to the ENV table the modules so is more easy and safe to call from inside
_ENV.Bridge = Bridge -- Add the bridge too to the _ENV
exports(moduleName, function()
return wrappedModule
@@ -31,38 +31,19 @@ function Bridge.RegisterModule(moduleName, moduleTable)
--trigger update object event
TriggerEvent("Bridge:Refresh", moduleName, wrappedModule)
end
CreateThread(function() -- lets try to load the lib first to use it on the rest of the modules
for k, v in pairs(cLib) do
if v then
Bridge.RegisterModule(k, v)
end
end
end)
--- @module GlobalEnvironment
--- @field cLib table # Core library utilities, available globally after initialization.
--- @field Require fun(module: string): any # Function to require/load modules by name.
--- Global environment setup.
-- The following assignments expose core utilities globally,
-- making them accessible in all subsequently loaded modules.
_ENV.cLib = cLib ~= nil and cLib or export.community_lib.cLib() ---@type table
_ENV.Require = Require ---@type fun(module: string): any
exports("RegisterModule", Bridge.RegisterModule)
--TODO: Create a way to overide functions or create a new functions for module
function Bridge.RegisterModuleFunction(moduleName, functionName, func)
assert(moduleName and functionName and func,
string.format("Bridge.RegisterModuleFunction(%s, %s, %s) - Invalid arguments", moduleName, functionName, func))
assert(moduleName and functionName and func, string.format("Bridge.RegisterModuleFunction(%s, %s, %s) - Invalid arguments", moduleName, functionName, func))
Bridge[moduleName] = Bridge[moduleName] or {}
Bridge[moduleName][functionName] = func
--trigger update object event
TriggerEvent("Bridge:Refresh", moduleName, Bridge[moduleName])
end
--Bridge
Bridge.RegisterModule("Framework", Framework)
Bridge.RegisterModule("Inventory", Inventory)
@@ -94,27 +75,23 @@ Bridge.RegisterModule("Require", Require)
-- Bridge.RegisterModule("Skills", Skills)
--[[ CreateThread(function() -- using metatables
for k, v in pairs(cLib.loaded) do
if v then
Bridge.RegisterModule(k, v)
end
for k, v in pairs(cLib) do
if v then
Bridge.RegisterModule(k, v)
end
end) ]]
end
exports('Bridge', function()
return Bridge
end)
-- ▄▀▀ ██▀ █▀▄ █ █ ██▀ █▀▄
-- ▄█▀ █▄▄ █▀▄ ▀▄▀ █▄▄ █▀▄
-- ▄▀▀ ██▀ █▀▄ █ █ ██▀ █▀▄
-- ▄█▀ █▄▄ █▀▄ ▀▄▀ █▄▄ █▀▄
if not IsDuplicityVersion() then goto client end
Bridge.RegisterModule('Version', Version)
-- ▄▀▀ █ █ ██▀ █▄ █ ▀█▀
-- ▀▄▄ █▄▄ █ █▄▄ █ ▀█ █
-- ▄▀▀ █ █ ██▀ █▄ █ ▀█▀
-- ▀▄▄ █▄▄ █ █▄▄ █ ▀█ █
if IsDuplicityVersion() then return end
::client::