Skip to content

Commit

Permalink
added first steps for mod registering
Browse files Browse the repository at this point in the history
  • Loading branch information
Lonaasan committed Sep 29, 2024
1 parent be9a38e commit 3108a92
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 3 deletions.
40 changes: 38 additions & 2 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
std = {
globals = {
prismaAPIRegistryStorage = {},
prismaAPIRegistry = {
fields = {
registerMods = {},
getMods = {}
}
},
prismaDebugLuacheck = {
fields = {
globalsTable = {},
Expand Down Expand Up @@ -309,10 +316,39 @@ std = {
},
debug = {
fields = {
log = {},
luacheck = {},
log = {
fields = {
tableList = {},
detailedTableTree = {},
tableTree = {},
error = {},
warn = {},
info = {}
}
},
luacheck = {
fields = {
cleanUp = {},
customEncode = {},
globalsTable = {}
}
},
enabled = {}
}
},
api = {
fields = {
registry = {
fields = {
mods = {
fields = {
TestMod = {}
}
}
}
},
bridge = {}
}
}
}
},
Expand Down
6 changes: 6 additions & 0 deletions Prisma/prisma/api/bridge.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---Prisma API Bridge | https://github.com/Lonaasan/Prisma/blob/main/Prisma/prisma/api/bridge.lua
---Author: Lonaasan

string.prisma = string.prisma or {};
string.prisma.api = string.prisma.api or {};
string.prisma.api.bridge = {};
26 changes: 26 additions & 0 deletions Prisma/prisma/api/registry.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---Prisma API Registry | https://github.com/Lonaasan/Prisma/blob/main/Prisma/prisma/api/registry.lua
---Author: Lonaasan

string.prisma = string.prisma or {};
string.prisma.api = string.prisma.api or {};
string.prisma.api.registry = string.prisma.api.registry or {};
string.prisma.api.registry.mods = string.prisma.api.registry.mods or {};

prismaAPIRegistry = {};

local prismaAPIRegistryStorage = {};

function prismaAPIRegistry.registerMods()
for modName, mod in pairs(string.prisma.api.registry.mods) do
string.prisma.debug.log.info("Registering mod: " .. modName);
string.prisma.debug.log.info("Mod: " .. mod);
prismaAPIRegistryStorage[modName] = mod;
end
end

function prismaAPIRegistry.getMods()
for modName, mod in pairs(prismaAPIRegistryStorage) do
string.prisma.debug.log.info("Stored mod: " .. modName);
string.prisma.debug.log.info("Mod: " .. mod);
end
end
14 changes: 14 additions & 0 deletions Prisma/prisma/core/generic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

require("/prisma/debug/log.lua");
require("/prisma/debug/luacheck.lua");
require("/prisma/api/registry.lua");

local _init = init or function()
end;
Expand All @@ -17,7 +18,17 @@ string.prisma = string.prisma or {};
string.prisma.debug = string.prisma.debug or {};
string.prisma.debug.enabled = false;



string.prisma = string.prisma or {};
string.prisma.api = string.prisma.api or {};
string.prisma.api.registry = string.prisma.api.registry or {};
string.prisma.api.registry.mods = string.prisma.api.registry.mods or {};



function init(...)
string.prisma.api.registry.mods.TestMod = "TestMod Content";
return _init(...);
end

Expand All @@ -38,6 +49,9 @@ function update(...)
if resultString then
prismaDebugLog.info(resultString)
end

prismaAPIRegistry.registerMods();
prismaAPIRegistry.getMods();
end
return _update(...);
end
Expand Down
2 changes: 1 addition & 1 deletion Prisma/prisma/debug/luacheck.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--- Prisma Debug Luacheck | https://github.com/Lonaasan/Prisma/blob/main/Prisma/prisma/debug/luacheck.lua
--- Prisma Debug Luacheck Utils | https://github.com/Lonaasan/Prisma/blob/main/Prisma/prisma/debug/luacheck.lua
--- Author: Lonaasan

string.prisma = string.prisma or {};
Expand Down

0 comments on commit 3108a92

Please sign in to comment.