Advertisement
Arimus

bundledAPI

Aug 12th, 2013
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1. --[[
  2. Output API, By SuPeRMiNoR2 (With help from immibis)
  3. LICENSE
  4. http://creativecommons.org/licenses/by-nc/3.0/
  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, provided you leave the license comment in. ]]--
  7. --Version: 1.5
  8.  
  9. local side = "back"
  10.  
  11. function alloff()
  12.   rs.setBundledOutput(side, 0)
  13. end
  14.  
  15. function set(color, state)
  16.  color = colors[color] or colours[color]
  17.  if not color then
  18.   error("Invalid colour", 2)
  19.  end
  20.  local func = (state and colors.combine or colors.subtract)
  21.  rs.setBundledOutput(side, func(rs.getBundledOutput(side), color))
  22. end
  23.  
  24. function get(color)
  25.  color = colors[color] or colours[color]
  26.  return rs.testBundledInput(side, color)
  27. end
  28.  
  29. function toggle(color)
  30.  cstate = get(color)
  31.  if cstate == false then
  32.  set(color, true)
  33.  end
  34.  if cstate == true then
  35.  set(color, false)
  36.  end
  37. end
  38.  
  39. --[[
  40. function setadv(sided, color, state)
  41.  color = colors[color] or colours[color]
  42.  if not color then
  43.   error("Invalid colour", 2)
  44.  end
  45.  local func = (state and colors.combine or colors.subtract)
  46.  rs.setBundledOutput(sided, func(rs.getBundledOutput(sided), color))
  47. end
  48. --]]
  49.  
  50. function setside(s)
  51.  side = s
  52. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement