Difference between revisions of "Term.blit"
From ComputerCraft Wiki
Bomb Bloke (Talk | contribs) m |
Bomb Bloke (Talk | contribs) (Can use spaces as colours) |
||
Line 7: | Line 7: | ||
|desc=Added by ComputerCraft 1.74, term.blit() functions in nearly the same manner as [[term.write]](), but instead of using the current text and background colours, it accepts additional strings specifying colour codes for each individual character. Although it is no faster than term.write() in its own right, in some circumstances it can reduce code length and speed execution by removing the need to make multiple [[term.setTextColor]]() / [[term.setBackgroundColor]]() calls.<br><br> | |desc=Added by ComputerCraft 1.74, term.blit() functions in nearly the same manner as [[term.write]](), but instead of using the current text and background colours, it accepts additional strings specifying colour codes for each individual character. Although it is no faster than term.write() in its own right, in some circumstances it can reduce code length and speed execution by removing the need to make multiple [[term.setTextColor]]() / [[term.setBackgroundColor]]() calls.<br><br> | ||
− | Each character in the text/background colour strings must be a valid "paint" symbol from ComputerCraft's [[Colors_%28API%29#Colors|list of colours]] (eg, "a" for purple, "3" for light blue, "e" for red, etc), in the same order as the text characters they are to be applied to. The three strings must each be of the same length. Note that only advanced systems can render in colour - if unsupported shades are requested on a normal system, no error will occur but black will be used instead. | + | Each character in the text/background colour strings must be a valid "paint" symbol from ComputerCraft's [[Colors_%28API%29#Colors|list of colours]] (eg, "a" for purple, "3" for light blue, "e" for red, etc), in the same order as the text characters they are to be applied to. Spaces may also be used: in the text colour string, they'll be taken for white, whereas in the background colour string they'll be taken for black. The three strings must each be of the same length. Note that only advanced systems can render in colour - if unsupported shades are requested on a normal system, no error will occur but black will be used instead. |
|examples= | |examples= | ||
{{Example | {{Example |
Latest revision as of 23:42, 16 December 2015
Function term.blit | |
Added by ComputerCraft 1.74, term.blit() functions in nearly the same manner as term.write(), but instead of using the current text and background colours, it accepts additional strings specifying colour codes for each individual character. Although it is no faster than term.write() in its own right, in some circumstances it can reduce code length and speed execution by removing the need to make multiple term.setTextColor() / term.setBackgroundColor() calls. Each character in the text/background colour strings must be a valid "paint" symbol from ComputerCraft's list of colours (eg, "a" for purple, "3" for light blue, "e" for red, etc), in the same order as the text characters they are to be applied to. Spaces may also be used: in the text colour string, they'll be taken for white, whereas in the background colour string they'll be taken for black. The three strings must each be of the same length. Note that only advanced systems can render in colour - if unsupported shades are requested on a normal system, no error will occur but black will be used instead. | |
Syntax | term.blit(string text, string text colours, string background colours) |
Returns | nil |
Part of | ComputerCraft |
API | term |
Examples
Example | |
Writes the letter "a", using a blue text colour ("b"), and a brown background colour ("c"). | |
Code |
term.blit("a","b","c") |
Output | a |
Example | |
Writes RAINBOW!, making use of all colours. | |
Code |
term.blit("RAINBOW!","01234567","89abcdef") |
Output | RAINBOW! |
Example | |
Writes "Hello, World!", using black text on a white background. | |
Code |
term.blit("Hello, World!","fffffffffffff","0000000000000") |
Output | Hello, World! |