mirror of
https://github.com/20kdc/OC-KittenOS.git
synced 2024-11-16 15:38:05 +11:00
Finished some missing bits of Omniterm
One-line history (for spam) and a basic root Lua terminal, since that's the thing everybody uses for testing components.
This commit is contained in:
parent
ea6b987c21
commit
6ff93ed7d8
@ -16,15 +16,17 @@ if not consoleBuffer then
|
|||||||
"rpc:<appId> |RPC",
|
"rpc:<appId> |RPC",
|
||||||
"tun:<CA> |Linked Card",
|
"tun:<CA> |Linked Card",
|
||||||
"net:<RA>:<pt>|Net.Card",
|
"net:<RA>:<pt>|Net.Card",
|
||||||
--Allows talking with everybody on a network.
|
--Broadcast (hopefully obvious?)
|
||||||
"net:<pt> |Net.Card-BC",
|
"net:<pt> |Net.Card-BC",
|
||||||
--Allows talking with MineOS Chat... in theory...
|
--Allows talking with MineOS Chat... in theory...
|
||||||
"moschat:<RA> |MineOS Chat",
|
"moschat:<RA> |MineOS Chat",
|
||||||
"componentlist|Components.",
|
"componentlist|Components.",
|
||||||
|
"lua |Lua console",
|
||||||
"Exit with Ctrl-W."
|
"Exit with Ctrl-W."
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local prevLine = ""
|
||||||
local lineBuffer = ""
|
local lineBuffer = ""
|
||||||
local function incomingSubLine(txt)
|
local function incomingSubLine(txt)
|
||||||
for i = 1, #consoleBuffer - 1 do
|
for i = 1, #consoleBuffer - 1 do
|
||||||
@ -170,7 +172,7 @@ local drivers = {
|
|||||||
end,
|
end,
|
||||||
-- componentlist
|
-- componentlist
|
||||||
-- Used to list components
|
-- Used to list components
|
||||||
-- Useful because OpenComputers stupidly cuts off text,
|
-- Useful because OpenComputers cuts off text,
|
||||||
-- which is really bad when you need the *whole* ID...
|
-- which is really bad when you need the *whole* ID...
|
||||||
-- >.< like when doing anything involving networking.
|
-- >.< like when doing anything involving networking.
|
||||||
componentlist = function (id)
|
componentlist = function (id)
|
||||||
@ -183,6 +185,18 @@ local drivers = {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end,
|
||||||
|
lua = function (id)
|
||||||
|
local root = A.request("root")
|
||||||
|
incomingLine("Lua Console")
|
||||||
|
outgoingLine = function (txt)
|
||||||
|
local r, re = pcall(function ()
|
||||||
|
local f, fe = load(txt, nil, root)
|
||||||
|
if not f then error(fe) end
|
||||||
|
return f()
|
||||||
|
end)
|
||||||
|
incomingLine(tostring(re))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
local hasDriver = false
|
local hasDriver = false
|
||||||
@ -247,8 +261,13 @@ function app.key(ka, kc, down)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if down then
|
if down then
|
||||||
|
if kc == 200 then
|
||||||
|
lineBuffer = prevLine
|
||||||
|
return true
|
||||||
|
end
|
||||||
if ka ~= 0 then
|
if ka ~= 0 then
|
||||||
if ka == 13 then
|
if ka == 13 then
|
||||||
|
prevLine = lineBuffer
|
||||||
typedLine(lineBuffer)
|
typedLine(lineBuffer)
|
||||||
lineBuffer = ""
|
lineBuffer = ""
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user