zilvar2k11

CC Redstone OR Gate

Jul 9th, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. local tArgs = {...}
  2.  
  3. --
  4.  
  5. if #tArgs ~= 0 then
  6.    print("Usage: orGate")
  7.    print("  -- the side opposite the screen is output")
  8.    print("  -- output is hot if any side (front,left,right) is hot")
  9.    return
  10. end
  11.  
  12. local sides = toNumber(tArgs[1])
  13.  
  14. local function testSide(side)
  15.    return ( (redstone.getInput(side)) or (redstone.getBundledInput(side) >0) )
  16.  
  17. end
  18.  
  19.  
  20. while true do
  21.  
  22.    if ( testSide("right") or testSide("left") or testSide("front") ) then
  23.      redstone.setOutput("back",true)
  24.      redstone.setBundledOutput("back",255)
  25.    else
  26.      redstone.setOutput("back",false)
  27.      redstone.setBundledOutput("back",0)
  28.    end
  29.  
  30.    os.pullEvent("redstone")
  31. end
Advertisement
Add Comment
Please, Sign In to add comment