Advertisement
Guest User

listener.lua

a guest
Oct 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.36 KB | None | 0 0
  1. local tArgs = { ... }
  2. if #tArgs < 2 then
  3.     print("Usage: listener <frequency> <side>")
  4.     return
  5. end
  6.  
  7. local freq = tArgs[1]
  8. local side = tArgs[2]
  9.  
  10. rednet.open("bottom")
  11.  
  12. while true do
  13.     local id, msg, state  = rednet.receive()
  14.     if msg == freq then
  15.         rs.setOutput(side, state == "true")
  16. --        print(side.." set to "..state)
  17.     end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement