Sweet_L1ght

Untitled

Jun 13th, 2021 (edited)
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.20 KB | None | 0 0
  1. --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
  2. local ____exports = {}
  3. local ____component = require("component")
  4. local gpu = ____component.gpu
  5. local event = require("event")
  6. local keyboard = require("keyboard")
  7. local ____term = require("term")
  8. local setCursor = ____term.setCursor
  9. local exitProgram, clear
  10. function exitProgram(self, condition)
  11.     if condition then
  12.         os.exit(0)
  13.     end
  14. end
  15. function clear(self)
  16.     local width, height = gpu.getResolution()
  17.     gpu.setBackground(0)
  18.     return gpu.fill(1, 1, width, height, " ")
  19. end
  20. local function main(self)
  21.     clear(nil)
  22.     setCursor(1, 1)
  23.     while true do
  24.         local keyboardAddress, char, code, number, playerName = event.pull("key_down")
  25.         print(
  26.             (((((((("kAdr: " .. keyboardAddress) .. ", char: ") .. tostring(char)) .. ", code: ") .. tostring(code)) .. ", number: ") .. tostring(number)) .. ", player: ") .. tostring(playerName)
  27.         )
  28.         if number == 30 then
  29.             clear(nil)
  30.             setCursor(1, 1)
  31.         end
  32.         exitProgram(
  33.             nil,
  34.             (number == 30) and keyboard.isControlDown()
  35.         )
  36.     end
  37. end
  38. main(nil)
  39. return ____exports
  40.  
Add Comment
Please, Sign In to add comment