mast3rillusion

redstone.lua

Jul 27th, 2021 (edited)
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. -- ----------------------------------------
  2. -- redstone integrator connection and usage
  3. -- ----------------------------------------
  4. redstoneIntegrators = {}
  5.  
  6. found = false
  7.  
  8. for _, name in pairs(peripheral.getNames()) do
  9.     if peripheral.getType(name) == "redstoneIntegrator" then
  10.         periph = peripheral.wrap(name)
  11.         table.insert(redstoneIntegrators, periph)
  12.         found = true
  13.     end
  14. end
  15.  
  16. if found == false then
  17.     error("There must be at least one RedstoneIntegrator attached to this computer via wired modem!")
  18. end
  19.  
  20. function toggleRedstone(side, enabled)
  21.     for k,v in pairs(redstoneIntegrators) do
  22.         v.setOutput(side, enabled)
  23.     end
  24. end
Add Comment
Please, Sign In to add comment