made stuff more verbose
and also fixed modload using an outdated variant of the log library
This commit is contained in:
@@ -10,8 +10,12 @@ local moduleTypes = {}
|
||||
local function loadModule(modName)
|
||||
local moduleData = modules[modName]
|
||||
table.remove(moduleList, table.find(moduleList, modName))
|
||||
if not moduleData then return end
|
||||
if not moduleData then
|
||||
log.kernel.warn(string.format("[modload: %s] Could not find module data.", modName))
|
||||
return
|
||||
end
|
||||
if not moduleData.check() then
|
||||
log.kernel.info(string.format("[modload: %s] Module not ready - skipping", modName))
|
||||
return
|
||||
end
|
||||
if moduleData.dependencies then
|
||||
@@ -31,18 +35,22 @@ local function loadModule(modName)
|
||||
end
|
||||
end
|
||||
--print(modName)
|
||||
log.kernel.info(string.format("[modload: %s] Loading module", modName))
|
||||
if moduleData.init then -- I have no idea why this would not exist, but it's a failsafe
|
||||
moduleData.init()
|
||||
end
|
||||
end
|
||||
|
||||
for _, modName in pairs(moduleList) do -- Get all the module types
|
||||
log.kernel.info(string.format("[modload: %s] Getting data from module", modName))
|
||||
local moduleData = require(fs.concat(modulePath, modName)) -- TODO: Make this not actually throw an error, rather put something in the log and move on
|
||||
if type(moduleData)~="table" then
|
||||
log.add(string.format("[modload: %s] Module returned invalid type (%s) - skipping",modName,type(moduleData)),"error")
|
||||
if type(moduleData) ~= "table" then
|
||||
log.kernel.error(
|
||||
string.format("[modload: %s] Module returned invalid type (%s) - skipping", modName, type(moduleData))
|
||||
)
|
||||
goto continue
|
||||
end
|
||||
modules[modName]=moduleData
|
||||
modules[modName] = moduleData
|
||||
if moduleData.type then
|
||||
--print(moduleData.type)
|
||||
moduleTypes[modName] = moduleData.type -- Not the other way around because there can be multiple modules of the same type, but there can't be multiple entries with the same key
|
||||
|
||||
@@ -32,7 +32,9 @@ function _G._PUBLIC.tsched.runAsTask(path, ...)
|
||||
local userland = table.copy(_PUBLIC)
|
||||
userland._G = userland
|
||||
userland.load = function(chunk, chunkname, mode, env)
|
||||
if not env or env == _G then env = userland end -- if they SOMEHOW get the kernel environment they're not running jack shit
|
||||
if not env or env == _G then
|
||||
env = userland
|
||||
end -- if they SOMEHOW get the kernel environment they're not running jack shit
|
||||
return load(chunk, chunkname, mode, env)
|
||||
end
|
||||
userland.require = reqgen(userland.load)
|
||||
@@ -65,8 +67,9 @@ function _G._PUBLIC.tsched.addTask(func, name)
|
||||
table.insert(tsched.tasks, taskInfo)
|
||||
idCounter = idCounter + 1
|
||||
if taskInfo.parent then
|
||||
log.kernel.info("Created task " .. name .. " with PID " .. idCounter - 1 .. " by parent with PID " .. taskInfo
|
||||
.parent)
|
||||
log.kernel.info(
|
||||
"Created task " .. name .. " with PID " .. idCounter - 1 .. " by parent with PID " .. taskInfo.parent
|
||||
)
|
||||
else
|
||||
log.kernel.info("Created task " .. name .. " with PID " .. idCounter - 1 .. " (no parent found)")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user