mirror of
https://github.com/20kdc/OC-KittenOS.git
synced 2024-11-16 23:48:05 +11:00
30 lines
579 B
Lua
30 lines
579 B
Lua
|
local math, table = A.request("math", "table")
|
||
|
local app = {}
|
||
|
local strs = {"", "Shift-C to quit."}
|
||
|
local keys = {}
|
||
|
local function rebuildKeys()
|
||
|
local keylist = {}
|
||
|
for k, v in pairs(keys) do
|
||
|
if v then
|
||
|
table.insert(keylist, k)
|
||
|
end
|
||
|
end
|
||
|
table.sort(keylist)
|
||
|
strs[1] = ""
|
||
|
for _, v in ipairs(keylist) do
|
||
|
strs[1] = strs[1] .. v .. " "
|
||
|
end
|
||
|
end
|
||
|
app.key = function(ka, kc, down)
|
||
|
if ka == ("C"):byte() and down then
|
||
|
A.die()
|
||
|
return false
|
||
|
end
|
||
|
keys[kc] = down
|
||
|
rebuildKeys()
|
||
|
return true
|
||
|
end
|
||
|
app.get_ch = function (x, y)
|
||
|
return (strs[y]):sub(x, x)
|
||
|
end
|
||
|
return app, 20, 2
|