Difference between revisions of "Printer.endPage"

From ComputerCraft Wiki
Jump to: navigation, search
m (Moved to CAT:LuaCoreFunctions)
m (Expanded)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{lowercase}}
 
{{lowercase}}
 
{{Function
 
{{Function
|name=printer.endPage
+
|name=''printer''.endPage
|args=none
+
|returns={{type|boolean}} was the page printed?
|returns=[[boolean|(boolean)]] If the page termination was successful.
+
|api=printer
|api=none
+
 
|addon=ComputerCraft
 
|addon=ComputerCraft
|desc=Terminates and prints the page loaded.
+
|desc=Ends and prints the page to the output tray. Returns true if page was ended, false if not.<br/><br/>This function will return false if there is no place to print the page or if there is no page started.
 
|examples=
 
|examples=
 
{{Example
 
{{Example
 
|desc= Prints out the current page.
 
|desc= Prints out the current page.
|code=print(printer.endPage())
+
|code= local printer = [[peripheral.wrap]]("left")
|output=true if the page printed successfully, otherwise false
+
 +
[[printer.newPage]]()
 +
[[printer.write]]("Hello")
 +
 +
if printer.endPage() then
 +
  print("Page was printed successfully!")
 +
else
 +
  error("Could not print page.")
 +
end
 +
|output=Prints whether or not the printer was able to print the page.
 
}}
 
}}
 
}}
 
}}
  
 
[[Category:Lua_Core_Functions]]
 
[[Category:Lua_Core_Functions]]

Latest revision as of 18:00, 9 April 2014


Grid Redstone.png  Function printer.endPage
Ends and prints the page to the output tray. Returns true if page was ended, false if not.

This function will return false if there is no place to print the page or if there is no page started.
Syntax printer.endPage()
Returns boolean was the page printed?
Part of ComputerCraft
API printer

Examples

Grid paper.png  Example
Prints out the current page.
Code
local printer = peripheral.wrap("left")

printer.newPage()
printer.write("Hello")

if printer.endPage() then
  print("Page was printed successfully!")
else
  error("Could not print page.")
end
Output Prints whether or not the printer was able to print the page.