v0.2.0 - Added startup apps and an event handler process (unfinished)

This commit is contained in:
TheWahlolly
2025-04-03 21:19:50 +03:00
parent 4adc959549
commit 7b8e237abe
10 changed files with 742 additions and 690 deletions
+21 -3
View File
@@ -1,12 +1,15 @@
_G.cormgr = {}
_G.cormgr.corList = {}
--local ocelot = component.proxy(component.list("ocelot")())
local filesystem = import("filesystem")
function _G.cormgr.loadCoroutine(path)
local cor = coroutine.create(function()
import(path)
end)
table.insert(_G.cormgr.corList, cor)
coroutine.yield()
end
function handleError(errormsg)
@@ -14,7 +17,19 @@ function handleError(errormsg)
assert(false, errormsg)
end
_G.cormgr.loadCoroutine("/halyde/core/loader.lua")
local handle = filesystem.open("/halyde/config/startupapps.txt", "r")
local data = ""
local tmpdata
repeat
tmpdata = handle:read(math.huge or math.maxinteger)
data = data .. (tmpdata or "")
until not tmpdata
for line in data:gmatch("([^\n]*)\n?") do
if line ~= "" then
_G.cormgr.loadCoroutine(line)
end
end
_G.cormgr.loadCoroutine("/halyde/core/shell.lua")
while true do
for i = 1, #_G.cormgr.corList do
@@ -25,6 +40,9 @@ while true do
handleError(errormsg)
end
end
computer.pullSignal(1)
computer.pullSignal(0)
end
if #_G.cormgr.corList == 0 then
computer.shutdown()
end
end