textutils.pagedPrint

From ComputerCraft Wiki
Jump to: navigation, search


Grid Redstone.png  Function textutils.pagedPrint
Prints a given string to the display. If the action can be completed without scrolling, it acts much the same as print(); otherwise, it will throw up a "Press any key to continue" prompt at the bottom of the display. Each press will cause it to scroll down and write a single line more before prompting again, if need be.

If freeLines is specified, then that amount of lines will be auto-scrolled before the first prompt appears (generally meaning the initial amount of lines printed at least equals freeLines + 1). Each press after this point will still only scroll a single line, however. If not specified, the function will not scroll at all without prompting.
Syntax textutils.pagedPrint(string text [, number freeLines])
Returns The number of lines printed.
Part of ComputerCraft
API textutils

Examples

Grid paper.png  Example
Prints a lengthy string (thirty copies of a sentence generated with string.rep()), prompting the user to continue if any scrolling is required past the first ten lines.
Code
textutils.pagedPrint(string.rep("This is a rather verbose dose of repetition. ",30), 9)
Output "This is a rather verbose dose of repetition. This is a rather verbose dose of repetition. This is a rather verbose dose of repetition. "...etc printed to the display, with a "Press any key to continue" prompt if scrolling is required after at least ten lines have been written.
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox