View difference between Paste ID: ykqGrjeZ and knNtHGvg
SHOW: | | - or go back to the newest paste.
1-
local t = { ["white"] = { "colors.white", true }, ["orange"] = { "colors.orange", false } }
1+
local side = "back"
2
local modem = "top"
3-
for k,v in pairs( t ) do
3+
local c = 0
4-
  if v[ 2 ] == true then
4+
local colortable = 
5-
    print( v[ 1 ] )
5+
{ 
6-
  end
6+
	["white"] = { colors.white, false }, 
7
	["orange"] = { colors.orange, false },
8
	["magenta"] = { colors.magenta, false },
9
	["lightBlue"] = { colors.lightBlue, false },
10
	["yellow"] = { colors.yellow, false },
11
	["lime"] = { colors.lime, false },
12
	["pink"] = { colors.pink, false }, 
13
	["gray"] = { colors.gray, false }, 
14
	["lightGray"] = { colors.lightGray, false }, 
15
	["cyan"] = { colors.cyan, false }, 
16
	["purple"] = { colors.purple, false }, 
17
	["blue"] = { colors.blue, false }, 
18
	["brown"] = { colors.brown, false }, 
19
	["green"] = { colors.green, false }, 
20
	["red"] = { colors.red, false }, 
21
	["black"] = { colors.black, false } 
22
}
23
24
-- Check and save active outputs
25
function check()
26
	for k,v in pairs( colortable ) do
27
 		result = redstone.testBundledInput(side, v[ 1 ])
28
		v[ 2 ] = result
29
	end
30
end
31
32
-- Set new output
33
function set()
34
	for k,v in pairs( colortable ) do
35
 		 if v[ 2 ] == true then
36
			c = c + v[ 1 ]
37
  		end
38
	end
39
	redstone.setBundledOutput(side, c)
40
end
41
42
check()
43
44
while true do
45
id, cmd = rednet.receive()
46
  	if cmd == "on" then
47
		redstone.setBundledOutput("back", colors.white)
48
		check()
49
    	set()
50
    elseif cmd == "off" then
51
       redstone.setBundledOutput("back", 0)
52
    end
53
	sleep(0.75)
54
end