Advertisement
maxtorcd55

textext

Apr 4th, 2014
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.42 KB | None | 0 0
  1. local page = 0
  2. local screenH
  3.  
  4. if turtle then
  5.         screenH = 14
  6. else
  7.         screenH = 20
  8. end
  9. local lineH = screenH-5
  10. while (true) do
  11.     p = peripheral.wrap("top")
  12.     t = p.getNamesRemote()
  13.     term.clear()
  14.     term.setCursorPos(1,1)
  15.     for i = 1+(lineH*page), lineH+(lineH*page) do
  16.         if t[i] ~= nil then
  17.             if string.len(t[i]) < 40 then
  18.                 print(string.format("%-2d", i) .." = " ..t[i])
  19.             else
  20.                 local frontz = string.sub(t[i], 1, 9)
  21.                 local backz = string.sub(t[i], -20)
  22.                 print(string.format("%-2d", i) .." = " ..frontz.."..."..backz)
  23.             end
  24.         end
  25.     end
  26.     term.setCursorPos(1,screenH-4)
  27.     print("---------------------------------------")
  28.     print("['ENTER' getMethods|'UP/DOWN' navigate]")
  29.     print("page: " ..page+1 .."/" ..tonumber(string.format("%01d", (#t/lineH)+1)))
  30.     local event, keypress = os.pullEvent("key")
  31.     if keypress == 208 then
  32.         page = page + 1
  33.         if page >= tonumber(string.format("%01d", (#t/lineH))) then
  34.             page = tonumber(string.format("%01d", (#t/lineH)))
  35.         end
  36.  
  37.     elseif keypress == 200 then
  38.         page = page - 1
  39.         if page < 0 then
  40.             page = 0
  41.         end
  42.     elseif keypress == 28 then
  43.         print("")
  44.         print("[give list number]")
  45.         number = tonumber(read())
  46.         k = p.getMethodsRemote(t[number])
  47.         term.clear()
  48.         term.setCursorPos(1,1)
  49.         for i = 1, #k do
  50.             print(k[i])
  51.         end
  52.         print("[press any key to continu]")
  53.        
  54.         local event,keypress = os.pullEvent("key")
  55.         if keypress == 14 then
  56.         end
  57.     end
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement