Added simple event printer

This commit is contained in:
Casey 2023-10-17 19:11:16 +03:00
parent e780d7017e
commit 0e047a5b35
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 15 additions and 0 deletions

15
events.lua Normal file
View File

@ -0,0 +1,15 @@
local pretty = require("cc.pretty")
while true do
local evd = { os.pullEvent() }
local ev, evd = table.remove(evd, 1), evd
if ev == "key_up" and evd[1] == keys.q then
break
elseif ev == "term_resize" then
local w, h = term.getSize()
print("term_resize", w, h)
else
io.write(ev.." ")
pretty.print(pretty.pretty(evd))
end
end