OC-PsychOS/modules/drivers/kbd.lua

21 lines
403 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")
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