Files
2026-06-14 02:27:37 +03:00

38 lines
924 B
Lua

-- IOC.lua — I/O Controller (AtlasOS Terminal v2.0)
-- out[1] = display_text → Terminal
-- out[2] = display_clear → Terminal
-- out[3] = display_color → Terminal
-- out[4] = cmd_tx → CMC.in[1] (IN|command)
-- in[1] = user_input ← Terminal
-- in[2] = cmd_rx ← CMC.out[1] (OUT|text / CLR / COL|R,G,B)
local txActive = false
inp = {}
function upd()
if inp[1] ~= nil then
out[4] = "IN|" .. tostring(inp[1])
txActive = true
elseif txActive then
out[4] = ""
txActive = false
end
if inp[2] ~= nil then
local msg = tostring(inp[2])
local pipe = msg:find("|")
local op = pipe and msg:sub(1, pipe - 1) or msg
local arg = pipe and msg:sub(pipe + 1) or nil
if op == "OUT" and arg then
out[1] = arg
elseif op == "CLR" then
out[2] = 1
elseif op == "COL" and arg then
out[3] = arg
end
end
table.clear(inp)
end