Difference between revisions of "Printer.getPageSize"
From ComputerCraft Wiki
(Changing int to number) |
MKlegoman357 (Talk | contribs) m (Expanded) |
||
| Line 1: | Line 1: | ||
{{lowercase}} | {{lowercase}} | ||
{{Function | {{Function | ||
| − | |name=printer.getPageSize | + | |name=''printer''.getPageSize |
| − | |returns={{type|number}} | + | |returns={{type|number}} width of the page, {{type|number}} height of the page |
|api=printer | |api=printer | ||
|addon=ComputerCraft | |addon=ComputerCraft | ||
| − | |desc=Returns the size of the | + | |desc= Returns the size of the paper, works the same way as [[term.getSize]](). |
|examples= | |examples= | ||
{{Example | {{Example | ||
|desc=Prints the size of a page. | |desc=Prints the size of a page. | ||
| − | |code=local | + | |code= local printer = [[peripheral.wrap]]("left") |
| − | |output= | + | |
| + | [[printer.newPage]]() | ||
| + | |||
| + | local width, height = printer.getPageSize() | ||
| + | |||
| + | print("The size of the page is " .. width .. "x" .. height) | ||
| + | [[printer.write]]("Width: " .. width .. " Height: height") | ||
| + | |||
| + | [[printer.endPage]]() | ||
| + | |output=The size of the page is 25x21 | ||
}} | }} | ||
}} | }} | ||
[[Category:Lua_Core_Functions]] | [[Category:Lua_Core_Functions]] | ||
Latest revision as of 19:04, 9 April 2014
| Returns the size of the paper, works the same way as term.getSize(). | |
| Syntax | printer.getPageSize() |
| Returns | number width of the page, number height of the page |
| Part of | ComputerCraft |
| API | printer |
Examples
| Prints the size of a page. | |
| Code |
local printer = peripheral.wrap("left") printer.newPage() local width, height = printer.getPageSize() print("The size of the page is " .. width .. "x" .. height) printer.write("Width: " .. width .. " Height: height") printer.endPage() |
| Output | The size of the page is 25x21 |