Difference between revisions of "Printer.getPaperLevel"

From ComputerCraft Wiki
Jump to: navigation, search
(Changing int to number)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
{{lowercase}}
 
{{lowercase}}
 
{{Function
 
{{Function
|name=printer.getPaperLevel
+
|name=''printer''.getPaperLevel
 
|returns={{type|number}} the amount of paper in the printer
 
|returns={{type|number}} the amount of paper in the printer
 
|api=printer
 
|api=printer
 
|addon=ComputerCraft
 
|addon=ComputerCraft
|desc=Returns the total amount of paper in the printer.
+
|desc=Returns the amount of paper in the printer.
 
|examples=
 
|examples=
 
{{Example
 
{{Example
|desc=Prints paper level
+
|desc=Prints how much paper there is in the printer (assuming there are 5 sheets of paper in the printer).
|code=print(printer.getPaperLevel())
+
|code= local printer = [[peripheral.wrap]]("left")
 +
local paperAmount = '''printer.getPaperLevel()'''
 +
 +
print("There is/are " .. paperAmount .. " sheet(s) of paper in the printer.")
 +
|output=There is/are 5 sheet(s) of paper in the printer.
 
}}
 
}}
 
}}
 
}}
  
 
[[Category:Lua_Core_Functions]]
 
[[Category:Lua_Core_Functions]]

Latest revision as of 17:48, 10 April 2014


Grid Redstone.png  Function printer.getPaperLevel
Returns the amount of paper in the printer.
Syntax printer.getPaperLevel()
Returns number the amount of paper in the printer
Part of ComputerCraft
API printer

Examples

Grid paper.png  Example
Prints how much paper there is in the printer (assuming there are 5 sheets of paper in the printer).
Code
local printer = peripheral.wrap("left")
local paperAmount = printer.getPaperLevel()

print("There is/are " .. paperAmount .. " sheet(s) of paper in the printer.")
Output There is/are 5 sheet(s) of paper in the printer.