term.blit

From ComputerCraft Wiki
Revision as of 10:53, 28 June 2015 by Bomb Bloke (Talk | contribs) (Created page with "{{lowercase}} {{Function |name=term.blit |args= {{Type|string}} text, {{Type|string}} text colours, {{Type|string}} background colours |api=term |addon=ComputerCraft |desc=Add...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Grid Redstone.png  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. In some circumstances this removes the need to make multiple term.setTextColor() / term.setBackgroundColor() calls, allowing complex displays to be rendered in a far more efficient manner.

Each character in the text/background colour strings must be a valid "paint" symbol from ComputerCraft's list of colours (eg, "a", "3", "e", etc), and 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

Grid paper.png  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



Grid paper.png  Example
Writes RAINBOW!, making use of all colours.
Code
term.blit("RAINBOW!","01234567","89abcdef")
Output RAINBOW!