Bmorr

split_receive.lua

May 9th, 2025 (edited)
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.54 KB | None | 0 0
  1. --[[
  2.     pastebin get vjGicSAk split_receive.lua
  3. ]]
  4. -- Ensure Rednet is open
  5. peripheral.find("modem", rednet.open)
  6.  
  7. print("Listening for commands on the 'split' protocol...")
  8.  
  9. while true do
  10.     local senderId, message, protocol = rednet.receive("split")
  11.     print("Received command from ID " .. senderId .. ": " .. message)
  12.    
  13.     -- Execute the received command
  14.     local success, err = pcall(function()
  15.         shell.run(message)
  16.     end)
  17.    
  18.     if not success then
  19.         print("Error executing command: " .. err)
  20.     end
  21. end
Advertisement
Add Comment
Please, Sign In to add comment