Advertisement
Good_Pudge

ComponentMonitor

Sep 8th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.20 KB | None | 0 0
  1. local com = require("component")
  2. local gpu = com.gpu
  3. local term = require("term")
  4. local GPAPI = require("GPAPI")
  5. local color = require("colors")
  6. local unicode = require("unicode")
  7. local comp = require("computer")
  8. local kb = require("keyboard")
  9.  
  10. --Сохраняем старые настройки--
  11. local OldB = gpu.getBackground()
  12. local OldF = gpu.getForeground()
  13. local W,H = gpu.getResolution()
  14.  
  15. --Ставим новые--
  16. gpu.setBackground(color.silver,true)
  17. gpu.setForeground(color.black,true)
  18. gpu.setResolution(160,42)
  19.  
  20. local AddressList,NameList,ComList = {},{},com.list()
  21.  
  22. for k,v in pairs(ComList) do
  23.     print(k..v)
  24.     table.insert(AddressList,k)
  25.     table.insert(NameList,v)
  26. end
  27.  
  28. k,v = nil
  29. i = nil
  30.  
  31. GPAPI.textbox(1,2,"Component Monitor",nil,nil,nil,"center")
  32. GPAPI.textbox(150,24,"Выйти",color.black,color.silver)
  33.  
  34. while true do
  35.     local type,_,sX,sY,button,nick =  comp.pullSignal(0.01)
  36.  
  37.     GPAPI.button(sX,sY,150,24,5,1,GPAPI.exit,{OldB,OldF,W,H})
  38.  
  39.     for i = 1,#AddressList do
  40.         local colorL
  41.  
  42.         if colorL % 2 == 0 then
  43.             colorL = color.silver
  44.         else
  45.             colorL = color.black
  46.         end
  47.  
  48.         GPAPI.textbox(1,i,AddressList[i].."         "..NameList[i],colorL,_,_,"center")
  49.     end
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement