View difference between Paste ID: 2cjYLYeK and FPsMx5Ht
SHOW: | | - or go back to the newest paste.
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
    
20
    print("JenisOS V0.1")
21
    print("Logged in as "..user)
22
    
23
    while isPrint == true do
24
      line = tableScreen[num]
25
      if line ~= nil and num ~= cselected then
26
        print(line)
27
        num = num + 1
28
      elseif line ~= nil and num == cselected then
29
        print("["..line.."]")
30
        num = num + 1
31
      else
32
        isPrint = false
33
    end
34
    
35
    while rkeyp == true do
36
      event, param = os.pullEvent("key")
37
      if param == 200 then
38
        cselected = cselected - 1
39
        if cselected <= 0 then
40
          cselected = num
41
        end
42
        rkeyp = false
43
      elseif param == 208 then
44
        cselected = cselected + 1
45
        if cselected >= num then
46
          cselected = 1
47
        end
48
        rkeyp = false
49
      elseif param == 28 then
50
        return cselected
51
        rkeyp = false
52
        running = false
53
      end
54
    end
55
  end
56
end