OC-PsychOS/modules/drivers/kbd.lua

22 lines
461 B
Lua
Raw Normal View History

2017-07-30 19:12:10 +10:00
function kbd(kA,sI)
spawn("kbd: "..kA:sub(1,8),function()
while true do
local _,ka,c,C = event.pull("key_down")
2017-08-04 07:44:46 +10:00
if c == 18 and C == 19 then computer.shutdown(true) end
2017-07-30 19:12:10 +10:00
if ka == kA then
event.push("key",sI,c,C)
end
end
end)
spawn("kbd-clipboard: "..kA:sub(1,8),function()
while true do
local _,ka,s = event.pull("clipboard")
if ka == kA then
for c in s:gmatch(".") do
event.push("key",sI,string.byte(c),0)
end
end
end
end)
end