Posted 20 December 2014 - 02:29 AM
Hey there, Computercraft users!
I'm writing an API that would make stuff so much easier. I'd love to make a simplified background and text function. Currently, it's like this:
Now, is there a way to say "if color includes the string blah". I'd like to do this so that, I could do both:
Not sure if I'm explaining it well. Basically it detects if the "colors." is included in the argument. If it is, then go along. If it isn't, run the function as if it was there.
Catching my drift?
Hope you can help! Thanks so much!
I'm writing an API that would make stuff so much easier. I'd love to make a simplified background and text function. Currently, it's like this:
function bg(color)
term.setTextColor(color)
end
function txt(color)
term.setTextColor(color)
end
Now, is there a way to say "if color includes the string blah". I'd like to do this so that, I could do both:
--M is the api.
m.txt(yellow)
--OR
m.txt(colors.yellow)
Not sure if I'm explaining it well. Basically it detects if the "colors." is included in the argument. If it is, then go along. If it isn't, run the function as if it was there.
Catching my drift?
Hope you can help! Thanks so much!