v1
This commit is contained in:
+11
-13
@@ -4,9 +4,7 @@
|
||||
-- out[3] = display_color → Terminal
|
||||
-- out[4] = cmd_tx → CMC.in[1] (IN|command)
|
||||
-- in[1] = user_input ← Terminal
|
||||
-- in[2] = text_rx ← CMC.out[1] (OUT|text)
|
||||
-- in[3] = clear_rx ← CMC.out[2] (1 = clear)
|
||||
-- in[4] = color_rx ← CMC.out[3] (R,G,B)
|
||||
-- in[2] = cmd_rx ← CMC.out[1] (OUT|text / CLR / COL|R,G,B)
|
||||
|
||||
local txActive = false
|
||||
|
||||
@@ -23,16 +21,16 @@ function upd()
|
||||
|
||||
if inp[2] ~= nil then
|
||||
local msg = tostring(inp[2])
|
||||
local _, arg = msg:match("^(%w+)%|(.+)$")
|
||||
if arg then out[1] = arg end
|
||||
end
|
||||
|
||||
if inp[3] ~= nil and tonumber(inp[3]) == 1 then
|
||||
out[2] = 1
|
||||
end
|
||||
|
||||
if inp[4] ~= nil then
|
||||
out[3] = tostring(inp[4])
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user