Advertisement
Guest User

listapi.lua

a guest
Sep 17th, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | None | 0 0
  1. local component = require("component")
  2. local shell = require("shell")
  3. local event = require("event")
  4. local term = require("term")
  5. local args = shell.parse(...)
  6.  
  7. local adr = nil
  8. local comp = component.proxy(args[1])
  9. adr = args[1]
  10. if(comp == nil)
  11. then
  12.   adr = nil
  13.  
  14.   adr = component.get(args[1])
  15.  
  16.   for address,name in component.list(args[1]) do
  17.     if adr == nil
  18.     then
  19.       adr = address
  20.     end
  21.   end
  22.   comp = component.proxy(adr)
  23. end
  24.  
  25. term.clear()
  26. local temp = 0
  27. for name in pairs(comp) do
  28.   temp = temp + 1
  29.   if (temp % 25 == 0) and (temp ~= 0)
  30.   then
  31.     event.pull()
  32.     event.pull()
  33.     term.clear()
  34.   end
  35.   print(name)
  36. end
  37. event.pull()
  38. event.pull()
  39. term.clear()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement