Difference between revisions of "Term.getSize"

From ComputerCraft Wiki
Jump to: navigation, search
(Finish page)
(Changing int to number)
 
(5 intermediate revisions by 3 users not shown)
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=term.getSize
 
|name=term.getSize
|returns=The width and height of the terminal window.
+
|returns={{type|number}} the width and height of the terminal window.
 
|api=term
 
|api=term
 
|addon=ComputerCraft
 
|addon=ComputerCraft
Line 9: Line 9:
 
{{Example
 
{{Example
 
|desc=Sets the cursor position to the edge of the terminal window.
 
|desc=Sets the cursor position to the edge of the terminal window.
|code=local w, h = term.getSize() term.setCursorPos(w,1)
+
|code=local w, h = term.getSize()<br />term.setCursorPos(w,1)
 
}}
 
}}
 
}}
 
}}
<!--
+
 
If anyone knows how to add the newline in the code, please do in between the getSize and setCursorPos and remove this comment.
+
[[Category:API_Functions]]
-->
+

Latest revision as of 11:51, 18 July 2013


Grid Redstone.png  Function term.getSize
Returns the width and height of the terminal window.
Syntax term.getSize()
Returns number the width and height of the terminal window.
Part of ComputerCraft
API term

Examples

Grid paper.png  Example
Sets the cursor position to the edge of the terminal window.
Code
local w, h = term.getSize()
term.setCursorPos(w,1)