Difference between revisions of "Textutils.pagedPrint"
From ComputerCraft Wiki
Bomb Bloke (Talk | contribs) (Created page with "{{lowercase}} {{Function |name=textutils.pagedPrint |args= string text [, number freeLines] |returns=The number of lines printed. |api=text...") |
MKlegoman357 (Talk | contribs) (Updated/Improved) |
||
Line 2: | Line 2: | ||
{{Function | {{Function | ||
|name=textutils.pagedPrint | |name=textutils.pagedPrint | ||
− | |args= | + | |args={{type|string}} text [, {{type|number}} freeLines] |
− | |returns= | + | |returns={{type|number}} linesPrinted |
|api=textutils | |api=textutils | ||
|addon=ComputerCraft | |addon=ComputerCraft | ||
− | |desc=Prints a given string to the display. If the action can be completed without scrolling, it acts much the same as [[print | + | |desc=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.<br><br> |
− | If | + | If <var>freeLines</var> 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 <var>freeLines + 1</var>). 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. Default value for <var>freeLines</var> is <var>0</var>. |
|examples= | |examples= | ||
{{Example | {{Example | ||
|desc=Prints a lengthy string (thirty copies of a sentence generated with [http://lua-users.org/wiki/StringLibraryTutorial string.rep()]), prompting the user to continue if any scrolling is required past the first ten lines. | |desc=Prints a lengthy string (thirty copies of a sentence generated with [http://lua-users.org/wiki/StringLibraryTutorial 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) | + | |code='''textutils.pagedPrint( [[string_(API)|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. | |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. | ||
}} | }} |
Latest revision as of 21:03, 16 February 2015
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. Default value for freeLines is 0. | |
Syntax | textutils.pagedPrint(string text [, number freeLines]) |
Returns | number linesPrinted |
Part of | ComputerCraft |
API | textutils |
Examples
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. |