guitarplayer616

peripheral++

Nov 24th, 2016
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. local sides = {}
  2. side = ""
  3. type = ""
  4.  
  5. function readTab(t)
  6.     for i,v in pairs(t) do
  7.         print(i,": ",v)
  8.     end
  9. end
  10.  
  11. --if not in sides then delete the directory
  12. --run code from directory directly
  13. --make random spaces go away
  14.  
  15. for _,v in pairs(peripheral.getNames()) do
  16.     if v then
  17.         side = v
  18.         type = peripheral.getType(v)
  19.         fs.makeDir(type)
  20.         for i,v in pairs(peripheral.getMethods(v)) do
  21.             local fileName = i
  22.             local methodData = v
  23.             local h = fs.open(type.."/"..v,"w")
  24.             h.writeLine("--"..type)
  25.             h.writeLine("local args = ...")
  26.             h.writeLine([[local p = peripheral.wrap("]]..side..[[")]])
  27.             h.writeLine("p."..v.."(args)")
  28.             h.flush()
  29.         end
  30.     end
  31. end
Add Comment
Please, Sign In to add comment