Guest User

jenisis

a guest
Jan 8th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. os.loadAPI("userinfo")
  2.  
  3. function drawScreen(tableScreen)
  4.   user = userinfo.getUser()
  5.  
  6.   running = true
  7.   rkeyp = true
  8.   cselected = 1
  9.   num = 1
  10.  
  11.   while running == true do
  12.     term.clear()
  13.     term.setCursorPos(1, 1)
  14.    
  15.     screenX, screenY = term.getSize()
  16.    
  17.     rkeyp = true
  18.     isPrint = true
  19.     num = 1
  20.    
  21.     print("JenisOS V0.1")
  22.     print("Logged in as "..user)
  23.     print(" ")
  24.    
  25.     while isPrint == true do
  26.       line = tableScreen[num]
  27.       if line ~= nil and num ~= cselected then
  28.         print(line)
  29.         num = num + 1
  30.       elseif line ~= nil and num == cselected then
  31.         print("["..line.."]")
  32.         num = num + 1
  33.       else
  34.         isPrint = false
  35.       end
  36.     end
  37.    
  38.     while rkeyp == true do
  39.       event, param = os.pullEvent("key")
  40.       if param == 200 then
  41.         cselected = cselected - 1
  42.         if cselected <= 0 then
  43.           cselected = num - 1
  44.         end
  45.         rkeyp = false
  46.       elseif param == 208 then
  47.         cselected = cselected + 1
  48.         if cselected >= num then
  49.           cselected = 1
  50.         end
  51.         rkeyp = false
  52.       elseif param == 28 then
  53.         return cselected
  54.       elseif param == 15 then
  55.         return 999
  56.       end
  57.     end
  58.   end
  59. end
Advertisement
Add Comment
Please, Sign In to add comment