v0.4.0 - Aaaand event.lua is no longer working. FUUUUUUUUU
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
local loadfile = ...
|
||||
local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile)
|
||||
|
||||
_G._OSVERSION = "Halyde 0.3.1"
|
||||
_G._OSVERSION = "Halyde 0.4.0"
|
||||
|
||||
function _G.import(module, ...)
|
||||
local args = table.pack(...)
|
||||
@@ -28,4 +28,4 @@ end
|
||||
--assert(handle:write("Bazinga!"))
|
||||
--handle:close()
|
||||
|
||||
import("/halyde/core/cormgr.lua")
|
||||
import("/halyde/core/cormgr.lua")
|
||||
@@ -13,11 +13,10 @@ function _G.cormgr.loadCoroutine(path)
|
||||
end
|
||||
|
||||
function handleError(errormsg)
|
||||
if errormsg~=nil then
|
||||
-- nothing for now
|
||||
error(tostring(errormsg))
|
||||
if errormsg == nil then
|
||||
error("unknown error")
|
||||
else
|
||||
error("An error has occured, but given as 'nil'.")
|
||||
error(tostring(errormsg).."\n \n"..debug.traceback())
|
||||
end
|
||||
end
|
||||
|
||||
@@ -59,4 +58,4 @@ while true do
|
||||
if #_G.cormgr.corList == 0 then
|
||||
computer.shutdown()
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -4,4 +4,19 @@ function table.find(table, item)
|
||||
return(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function table.copy(orig)
|
||||
local orig_type = type(orig)
|
||||
local copy
|
||||
if orig_type == 'table' then
|
||||
copy = {}
|
||||
for orig_key, orig_value in next, orig, nil do
|
||||
copy[table.copy(orig_key)] = table.copy(orig_value)
|
||||
end
|
||||
setmetatable(copy, table.copy(getmetatable(orig)))
|
||||
else -- number, string, boolean, etc
|
||||
copy = orig
|
||||
end
|
||||
return copy
|
||||
end
|
||||
+8
-13
@@ -7,21 +7,16 @@ local ocelot = component.proxy(component.list("ocelot")())
|
||||
while true do
|
||||
local args
|
||||
repeat
|
||||
args = computer.pullSignal(0)
|
||||
if args then
|
||||
ocelot.log("Sending signal "..args..","..computer.uptime())
|
||||
table.insert(evmgr.eventQueue, {computer.uptime(),args})
|
||||
args = {computer.pullSignal(0)}
|
||||
if args and args[1] then
|
||||
--ocelot.log("Sending signal "..args..","..computer.uptime())
|
||||
table.insert(evmgr.eventQueue, args)
|
||||
while #evmgr.eventQueue > maxEventQueueLength do
|
||||
ocelot.log("Queue length breach, removing first signal")
|
||||
--ocelot.log("Queue length breach, removing first signal")
|
||||
table.remove(evmgr.eventQueue, 1)
|
||||
end
|
||||
--ocelot.log("Event queue:")
|
||||
for i = 1, #evmgr.eventQueue do
|
||||
--ocelot.log("Args 1 and 2:")
|
||||
--ocelot.log(tostring(evmgr.eventQueue[i][1]))
|
||||
--ocelot.log(tostring(evmgr.eventQueue[i][2]))
|
||||
end
|
||||
end
|
||||
until not args
|
||||
until not args or not args[1]
|
||||
--ocelot.log("done")
|
||||
coroutine.yield()
|
||||
end
|
||||
end
|
||||
@@ -5,7 +5,7 @@ local event = import("event")
|
||||
|
||||
print("\n │\n │ ".._OSVERSION..'\n │ Welcome! Type "help" to get started.\n │')
|
||||
while true do
|
||||
--coroutine.yield()
|
||||
local args = {event.pull("key_down")}
|
||||
coroutine.yield()
|
||||
read()
|
||||
--ocelot.log(tostring(args[1]))
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user