Michael_Roy

Untitled

Apr 19th, 2026
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | Gaming | 0 0
  1. rednet.open("top")
  2. while true do
  3.     message=0
  4.     os.queueEvent("randomEvent")
  5.     os.pullEvent()
  6.     print("do you want to receive or send a message?")
  7.     print("1 for send and 2 for receive")
  8.     a=read()
  9.     a=tonumber(a)
  10.  
  11.     if a==1 then
  12.         print("type your message")
  13.         msg=read()
  14.         rednet.broadcast(msg)
  15.     end
  16.  
  17.     if a==2 then
  18.         print("waiting for the message")
  19.         while message == 0 do
  20.             id, message=rednet.receive()
  21.             print("here is your message")
  22.             print(message)
  23.         end
  24.     end
  25. end
Add Comment
Please, Sign In to add comment