Advertisement
augustclear

sendMessage

Dec 18th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.44 KB | None | 0 0
  1. local tArgs = { ... }
  2. if #tArgs ~= 1 then
  3.     print( "Usage: sendMessage <message>" )
  4.     return
  5. end
  6.  
  7. local message =tArgs[1]
  8.  
  9. local id = rednet.lookup("worker","ana")
  10. if id == nil then
  11.     print("Can't find worker")
  12.     return
  13. else
  14.     print("Sending to ID#"..tostring(id))
  15.     rednet.send(id, message, "worker")
  16. end
  17. sender, message = rednet.receive("home",5)
  18. if message == nil then
  19.     print("Timeout")
  20. else
  21.     print(message)
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement