Guest User

gui

a guest
Dec 11th, 2012
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. --Int--
  2.  
  3. local w,h = term.getSize()
  4. local running = true
  5. local ms = 1
  6. local select = 1
  7. local os = {
  8.       [1] = {"Epic win","Rainbow","Herp","Derp","Quit"}
  9. }
  10.  
  11. --Functions--
  12.  
  13. function clear()
  14.   term.clear()
  15.   term.setCursorPos(1,1)
  16. end
  17.  
  18. function center(str,ypos)
  19.   term.setCursorPos(w/2-#str/2,ypos)
  20.   write(str)
  21. end
  22.  
  23. function draw()
  24.   for i=1,#os[ms] do
  25.    if i == select then
  26.     center("[ "..os[ms][i].." ]",3*i)
  27.    else
  28.     center(os[ms][i],3*i)
  29.    end
  30.   end
  31. end
  32.  
  33. --Main--
  34.  
  35. draw()
  36. repeat
  37.   local event , key = os.pullEvent(key)
  38.   if key == 28 then
  39.    running = false
  40.   end
  41.   sleep(0.1)
  42. until running == false
Advertisement
Add Comment
Please, Sign In to add comment