Bjornir90

telecommande.lua

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