Advertisement
devomaa

Untitled

Jun 5th, 2021
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. "Rednet 'SSH'-Sender for Turtles and Computers."
  2.  
  3. id = 0
  4. running = true
  5. side = "right" --Side of the Modem
  6. --Functions
  7.  
  8. local function receive_instruction()
  9. rednet.open(top)
  10. while true do
  11. id, commandRaw, distance = rednet.receive()
  12. commandMain = tostring(commandRaw)
  13. id = tonumber(id)
  14.  
  15. --Auswertung
  16. write(id)
  17. write(" ")
  18. write(commandMain)
  19. write(" ")
  20. exe = fs.open("ssh_temp.lua", "w")
  21. exe.write(commandMain)
  22. exe.close()
  23. answerRaw = shell.run("ssh_temp.lua")
  24. answer = tostring(answerRaw)
  25. print(answer)
  26. rednet.send(id, answer)
  27.  
  28. end
  29. rednet.close(top)
  30. end
  31. --Functions END
  32.  
  33. --Main
  34. while running do
  35. receive_instruction()
  36. end
  37. --Main END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement