Advertisement
SuPeRMiNoR3

Output API [Distro]

Nov 28th, 2012
824
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2. Output API, By SuPeRMiNoR2 (With help from immibis)
  3. LICENSE
  4. http://creativecommons.org/licenses/by/3.0/deed.en_US
  5. This license only applies to THIS PROGRAM, not to minecraft, computercraft, or redpower
  6. You may edit, and/or use this program/API in your own programs/APIS. You do not have to leave this license comment in, but you can if you want :)  
  7. ]]--
  8.  
  9. --Version: 1.5
  10.  
  11. local side = "back"
  12.  
  13. function alloff()
  14.   rs.setBundledOutput(side, 0)
  15. end
  16.  
  17. function set(color, state)
  18.  color = colors[color] or colours[color]
  19.  if not color then
  20.   error("Invalid colour", 2)
  21.  end
  22.  local func = (state and colors.combine or colors.subtract)
  23.  rs.setBundledOutput(side, func(rs.getBundledOutput(side), color))
  24. end
  25.  
  26. function get(color)
  27.  color = colors[color] or colours[color]
  28.  return rs.testBundledInput(side, color)
  29. end
  30.  
  31. function toggle(color)
  32.  cstate = get(color)
  33.  if cstate == false then
  34.  set(color, true)
  35.  end
  36.  if cstate == true then
  37.  set(color, false)
  38.  end
  39. end
  40.  
  41. --[[
  42. function setadv(sided, color, state)
  43.  color = colors[color] or colours[color]
  44.  if not color then
  45.   error("Invalid colour", 2)
  46.  end
  47.  local func = (state and colors.combine or colors.subtract)
  48.  rs.setBundledOutput(sided, func(rs.getBundledOutput(sided), color))
  49. end
  50. --]]
  51.  
  52. function setside(s)
  53.  side = s
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement