Advertisement
incinirate

Router Script

Jun 27th, 2013
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.52 KB | None | 0 0
  1. modem="right"
  2.  
  3. rednet.open(modem)
  4. serverid=0
  5. comps={}
  6. while true do
  7.   id,message=rednet.receive()
  8.   print("Recieved message:"..message.." :from "..id)
  9.   if id ~= serverid then
  10.     found=false
  11.     for i=1,#comps do
  12.       if id==comps[i] then
  13.         found=true
  14.       end
  15.     end
  16.     if found==true then
  17.       rednet.send(serverid,message)
  18.     else
  19.       table.insert(comps,id)
  20.       rednet.send(serverid,message)
  21.     end
  22.   else
  23.     for i=1,#comps do
  24.       rednet.send(comps[i],message)
  25.     end
  26.   end
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement