guitarplayer616

CC StreamData Master

Jun 11th, 2015
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. --Master--
  2. local tArgs = { ... }
  3. local sides = {"top","bottom","left","right","front","back"}
  4. for _,v in ipairs(sides) do
  5.   if peripheral.getType( v ) == "modem" then
  6.     rednet.open( v )
  7.   end
  8. end
  9.  
  10. if tArgs[1]:lower() == "master" then
  11.   term.clear()
  12.   term.setCursorPos(1,1)
  13.   check()
  14.   function check()
  15.     while true do
  16.       local f = io.read()
  17.       if f == "ls" then
  18.         shell.run("ls")
  19.       elseif f == "clr" then
  20.         shell.run("clr")
  21.       elseif fs.exists(f) then
  22.         local h = fs.open(f)
  23.         file = h.readAll()
  24.         h.close()
  25.         rednet.broadcast(file,"sm")
  26.       else
  27.         rednet.broadcast(f,"sm")
  28.       end
  29.     end
  30.   end
  31. end
Add Comment
Please, Sign In to add comment