Alexr360

Message Log

May 6th, 2025
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.49 KB | None | 0 0
  1. local modem = peripheral.find("modem") or error("No modem attached", 0)
  2. local CHANNEL = 15
  3. modem.open(CHANNEL) -- Open channel for communication
  4.  
  5. print("Listening for messages on channel " .. CHANNEL .. "...")
  6.  
  7. -- Main loop: continuously receive and print messages
  8. while true do
  9.     local event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message")
  10.     if channel == CHANNEL then
  11.         print("Received message: " .. textutils.serialize(message))
  12.     end
  13. end
  14.  
Advertisement
Add Comment
Please, Sign In to add comment