Advertisement
CelticCoder

testconnection

May 8th, 2024 (edited)
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. function send(message)
  2.     rednet.open("top") -- Open the modem on the top side
  3.    
  4.     print("Sending test message to server...")
  5.     rednet.broadcast(message, "testProtocol")
  6.     print("Message sent!")
  7. end
  8.  
  9. function recieve()
  10.     rednet.open("top") -- Open the modem on the top side
  11.  
  12.     while true do
  13.         local senderID, message, protocol = rednet.receive() -- Wait for incoming message
  14.         print("Received message from ID: " .. senderID)
  15.         print("Message: " .. message)
  16.     end
  17. end
  18.  
  19. print("Type a Message")
  20. send(read())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement