This “API” serves a global table that allows you to refer to colors by their name, instead of their associated ID/number. The table serves as a look-up in both directions, so for example colors.blue
has the value 11
, whereas colors[11]
has the string value blue
. These are the defined colors:
white
), Number: 0orange
), Number: 1magenta
), Number: 2lightblue
), Number: 3yellow
), Number: 4lime
), Number: 5pink
), Number: 6gray
), Number: 7silver
), Number: 8cyan
), Number: 9purple
), Number: 10blue
), Number: 11brown
), Number: 12green
), Number: 13red
), Number: 14black
), Number: 15Note that the indexing starts at zero, not one.
Useful for setting or getting bundled redstone output or input, for example:
local component = require("component") local colors = require("colors") local rs = component.redstone rs.setBundledOutput(sides.back, colors.green, rs.getBundledInput(sides.front, colors.blue))
would output the back signal strength to the front.