Difference between revisions of "Print"

From ComputerCraft Wiki
Jump to: navigation, search
m
m (Expanded)
 
(7 intermediate revisions by 6 users not shown)
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=print
 
|name=print
|args= [[string (type)|string]]
+
|args={{type|string}} text
 
|api=
 
|api=
 +
|returns={{type|number}} count of how many lines where printed
 
|addon=ComputerCraft
 
|addon=ComputerCraft
|desc=Lets you print the string on the terminal.
+
|desc=Lets you print anything to the terminal, automatically applies word-wrapping and scrolls down the display if needed. Prints all given arguments by using [[tostring]]() on them first. If no arguments are given, sets the cursor down a line and scrolls down if needed. For prompted scrolling, see [[textutils.pagedPrint]](); to avoid word-wrapping, see [[term.write]]().
 
|examples=
 
|examples=
 
{{Example
 
{{Example
|desc=Prints something.
+
|desc=Prints "Hello World!" on the computer's screen.
|code=print ("Hello World!")
+
|code='''print("Hello World!")'''
 
|output=Hello World!
 
|output=Hello World!
 
}}
 
}}
 
}}
 
}}
 +
 +
[[Category:Lua_Core_Functions]]

Latest revision as of 17:38, 10 April 2014


Grid Redstone.png  Function print
Lets you print anything to the terminal, automatically applies word-wrapping and scrolls down the display if needed. Prints all given arguments by using tostring() on them first. If no arguments are given, sets the cursor down a line and scrolls down if needed. For prompted scrolling, see textutils.pagedPrint(); to avoid word-wrapping, see term.write().
Syntax print(string text)
Returns number count of how many lines where printed
Part of ComputerCraft
API none

Examples

Grid paper.png  Example
Prints "Hello World!" on the computer's screen.
Code
print("Hello World!")
Output Hello World!