Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local page = 0
- local screenH
- if turtle then
- screenH = 14
- else
- screenH = 20
- end
- local lineH = screenH-5
- while (true) do
- p = peripheral.wrap("top")
- t = p.getNamesRemote()
- term.clear()
- term.setCursorPos(1,1)
- for i = 1+(lineH*page), lineH+(lineH*page) do
- if t[i] ~= nil then
- if string.len(t[i]) < 40 then
- print(string.format("%-2d", i) .." = " ..t[i])
- else
- local frontz = string.sub(t[i], 1, 9)
- local backz = string.sub(t[i], -20)
- print(string.format("%-2d", i) .." = " ..frontz.."..."..backz)
- end
- end
- end
- term.setCursorPos(1,screenH-4)
- print("---------------------------------------")
- print("['ENTER' getMethods|'UP/DOWN' navigate]")
- print("page: " ..page+1 .."/" ..tonumber(string.format("%01d", (#t/lineH)+1)))
- local event, keypress = os.pullEvent("key")
- if keypress == 208 then
- page = page + 1
- if page >= tonumber(string.format("%01d", (#t/lineH))) then
- page = tonumber(string.format("%01d", (#t/lineH)))
- end
- elseif keypress == 200 then
- page = page - 1
- if page < 0 then
- page = 0
- end
- elseif keypress == 28 then
- print("")
- print("[give list number]")
- number = tonumber(read())
- k = p.getMethodsRemote(t[number])
- term.clear()
- term.setCursorPos(1,1)
- for i = 1, #k do
- print(k[i])
- end
- print("[press any key to continu]")
- local event,keypress = os.pullEvent("key")
- if keypress == 14 then
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement