< Home | Recrafted | Blog | About >

Recrafted 1.3.0 / Textutils API extensions

Recrafted features a few noteworthy extensions to the textutils API.  These mostly relate to printing colored text.

  textutils.coloredWrite(...)
    Accepts strings, numbers, and tables.  For each argument:
      - If the argument is a string, writes it to the screen.
      - If the argument is a number, sets the terminal text color.
      - If the argument is a table:
        - Sets the text color to either arg.fg or arg[1], if present.
        - Sets the background color to either arg.bg or arg[2], if present.

    Returns the number of lines written.  Restores the original text and background colors.

  textutils.coloredPrint(...)
    Exactly the same as coloredWrite, but prints an extra newline at the end of the output.

  textutils.tabulate(...)
    Extension: If this function encounters a table, it will pass that table (unpacked) to coloredWrite.