I am creating something ( Its not important what it is
function someFunc( color1, color2, color3 )
-- How can I check if color1, color2, color3 is a valid color, like cyan
term.setTextColor( colors.color1 )
print( "Something" )
term.setTextColor( colors.color2 )
print( "Something again" )
term.setTextColor( colors.color3 )
print( "Something again, again" )
end
-- This is thought how I would write it, but I dont think it is efficient
function secondFunc( color1, color2, color3 )
local tColors = { "white", "orange", "magenta", } -- etc
local col1, col2, col3
for i = 1, #tColors do
if color1 == tColors[i] and not col1 then
color1 = colors. --curr color, not sure how to do this
col1 = true
end
if color2 == tColors[i] and not col2 then
color2 = colors. --curr color, not sure how to do this
col2 = true
end
if color3 == tColors[i] and not col3 then
color3 = colors. --curr color, not sure how to do this
col3 = true
end
end
if col1 and col2 and col3 then
term.setColor( col1 )
print( "Something" )
--Everything else from previous function except differnt color vars
return true
else
return false
end
end
I want to make this more efficient and I dont know how to actually set the color.
Thanks in advance,
Engineer












