Guest User

neuralReceive.lua

a guest
Apr 3rd, 2020
232
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local modemSide = "top"
  2. local protocol = "neural_net"
  3. local timeout = 30
  4. local scriptPath = "tmp/"
  5.  
  6. local ni = peripheral.wrap("back")
  7. rednet.open(modemSide)
  8. rednet.host(protocol, ni.getName())
  9.  
  10. while true do
  11.     local senderId, msg, _ = rednet.receive(protocol, timeout)
  12.     local path = scriptPath .. msg.name
  13.     local file = fs.open(path, 'w')
  14.     file.write(msg.content)
  15.     file.close()
  16.     rednet.send(senderId, "Received", protocol)
  17.     shell.run(path)
  18. end
RAW Paste Data