Advertisement
Guest User

neuralReceive.lua

a guest
Apr 3rd, 2020
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.47 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement