Advertisement
Guest User

getScreenSize

a guest
Sep 25th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. shell.run("clear")
  2. term.setCursorPos(0,0)
  3.  
  4. while true do
  5.  local BeforeX,BeforeY = term.getCursorPos()
  6.  io.write("#")
  7.  sleep()
  8.  local TestScreenSizeX,TestScreenSizeY = term.getCursorPos()
  9.  if TestScreenSizeY == 1 then
  10.   ScreenSizeX = BeforeX
  11.   break
  12.  end
  13. end
  14.  
  15. shell.run("clear")
  16.  
  17. term.setCursorPos(0,1)
  18. while true do
  19.  local BeforeX,BeforeY = term.getCursorPos()
  20.  term.setCursorPos(0,BeforeY)
  21.  print()
  22.  sleep()
  23.  local TestScreenSizeX,TestScreenSizeY = term.getCursorPos()
  24.  if TestScreenSizeY == BeforeY then
  25.   ScreenSizeY = BeforeY
  26.   break
  27.  end
  28. end
  29.  
  30. shell.run("clear")
  31. print(ScreenSizeX)
  32. print("x")
  33. print(ScreenSizeY)
  34. sleep(2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement