Advertisement
jaklsfjlsak

信号接收器 原型

Mar 22nd, 2025 (edited)
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. -- Open rednet on the modem side (adjust "left" as needed)
  2. rednet.open("top")
  3.  
  4. print("Waiting for coordinate broadcasts...")
  5.  
  6. while true do
  7.     local senderID, message, protocol = rednet.receive("coordBroadcast")
  8.    
  9.     if message and message.x and message.y and message.z then
  10.         print("Received coordinates from computer " .. senderID .. ":")
  11.         print("X: " .. message.x .. ", Y: " .. message.y .. ", Z: " .. message.z)
  12.         -- Add any further processing of the coordinates here
  13.     else
  14.         print("Received invalid data from computer " .. senderID)
  15.     end
  16. end
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement