Advertisement
Bjornir90

telecommande.lua

Nov 11th, 2012
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.95 KB | None | 0 0
  1. rednet.open("right")
  2. print("Entrez l'id de l'ordinateur destinataire")
  3. id = tonumber(io.read())
  4. shell.run("clear")
  5. print("Voulez-vous envoyez un programme (p) ou un fichier (f) ou quitter le programme de l'ordinateur rcepteur (exit)?")
  6. print("Tapez /quit pour quitter ce programme")
  7. type = io.read()
  8. rednet.send(id, type)
  9.  
  10. if type == "f" then
  11.  print("Quel est le nom du fichier a envoyer?")
  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("Fichier envoy")
  18.  
  19. elseif type == "p" then
  20.  print("Quel est le nom du programme ?")
  21.  programSend = io.read()
  22.  rednet.send(id, programSend)
  23.  print("Tapez l'argument du programme (0 si pas d'argument):")
  24.  argument = io.read()
  25.  rednet.send(id, argument)
  26.  print("Programme envoy")
  27.  
  28. elseif type == "exit" then
  29.  print("Programme quitt")
  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
Advertisement