Advertisement
Bjornir90

telecommandeeng.lua

Nov 13th, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. rednet.open("right")
  2. id = 9
  3.  
  4. print("Type the id of the addressee :")
  5. idToSend = io.read()
  6. shell.run("clear")
  7. rednet.send(id, idToSend)
  8.  
  9.  print("What do you want to do :")
  10.  print("Send a file (f) or a program (p)?")
  11.  print("Cut the communication with the other computer (exit)?")
  12.  print("Exit this program (/quit)?")
  13.  type = io.read()
  14.  rednet.send(id, type)
  15.  
  16. if type == "f" then
  17.  print("What is the name of the file ?")
  18.  fileOpen = io.read()
  19.  local file = fs.open(fileOpen, "r")
  20.  local sFile = file.readAll()
  21.  rednet.send(id, sFile)
  22.  file.close()
  23.  print("File sent")
  24.  
  25. elseif type == "p" then
  26.  print("What is the name of the program ?")
  27.  programSend = io.read()
  28.  rednet.send(id, programSend)
  29.  print("Type the argument of the program (0 if there is not argument):")
  30.  argument = io.read()
  31.  rednet.send(id, argument)
  32.  print("Program sent")
  33.  
  34. elseif type == "exit" then
  35.  print("Communication cut")
  36.  rednet.send(id, type)
  37.  
  38. elseif type == "/quit" then
  39.  shell.run("clear")
  40.  rednet.close("right")
  41.  return
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement