mirror of
https://github.com/20kdc/OC-KittenOS.git
synced 2024-11-16 15:38:05 +11:00
2ae3f9a93a
Currently eeprog pirate-speak language is unsupported, but... oh well.
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 |