<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.computercraft.info/wiki/index.php?action=history&amp;feed=atom&amp;title=Window.getPosition</id>
		<title>Window.getPosition - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://www.computercraft.info/wiki/index.php?action=history&amp;feed=atom&amp;title=Window.getPosition"/>
		<link rel="alternate" type="text/html" href="https://www.computercraft.info/wiki/index.php?title=Window.getPosition&amp;action=history"/>
		<updated>2026-07-11T07:15:36Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.24.1</generator>

	<entry>
		<id>https://www.computercraft.info/wiki/index.php?title=Window.getPosition&amp;diff=6365&amp;oldid=prev</id>
		<title>Bomb Bloke: Created page with &quot;{{lowercase}} {{Function |name=window.getPosition |returns={{type|number}} xPosition, {{type|number}} yPosition |api=term |addon=ComputerCraft |desc=A function available to wi...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.computercraft.info/wiki/index.php?title=Window.getPosition&amp;diff=6365&amp;oldid=prev"/>
				<updated>2014-04-07T11:20:02Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{lowercase}} {{Function |name=window.getPosition |returns={{type|number}} xPosition, {{type|number}} yPosition |api=term |addon=ComputerCraft |desc=A function available to wi...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{lowercase}}&lt;br /&gt;
{{Function&lt;br /&gt;
|name=window.getPosition&lt;br /&gt;
|returns={{type|number}} xPosition, {{type|number}} yPosition&lt;br /&gt;
|api=term&lt;br /&gt;
|addon=ComputerCraft&lt;br /&gt;
|desc=A function available to window-based [[term (API)|terminal objects]] created via the [[window (API)|window API]], which returns the x/y co-ordinates of the window's top-left point (within its ''parent'' terminal object).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See also: [[term.getSize|term.getSize()]], [[window.reposition|window.reposition()]]&lt;br /&gt;
|examples=&lt;br /&gt;
{{Example&lt;br /&gt;
|desc=Defines a child window in a parent window, and notes its location within that parent. [[window.reposition|Moves]] the parent and notes the location again, before moving the child window and making a final note.&lt;br /&gt;
|code= term.clear()&lt;br /&gt;
 term.setCursorPos(1,1)&lt;br /&gt;
 local lastX, lastY&lt;br /&gt;
 &lt;br /&gt;
 local parentWindow = window.create(term.current(), 5, 5, 10, 10)&lt;br /&gt;
 local childWindow = window.create(parentWindow, 2, 2, 1, 1)&lt;br /&gt;
 childWindow.write(&amp;quot;!&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
 term.setCursorPos(1,1)&lt;br /&gt;
 local xPos, yPos = childWindow.getPosition()&lt;br /&gt;
 print(&amp;quot;Child window is initially at &amp;quot;..xPos..&amp;quot;x&amp;quot;..yPos..&amp;quot;.&amp;quot;)&lt;br /&gt;
 lastX, lastY = term.getCursorPos()&lt;br /&gt;
 &lt;br /&gt;
 parentWindow.reposition(10,10)&lt;br /&gt;
 &lt;br /&gt;
 term.setCursorPos(lastX,lastY)&lt;br /&gt;
 xPos, yPos = childWindow.getPosition()&lt;br /&gt;
 print(&amp;quot;After moving the parent window, child window still registers as being at &amp;quot;..xPos..&amp;quot;x&amp;quot;..yPos..&amp;quot;.&amp;quot;)&lt;br /&gt;
 lastX, lastY = term.getCursorPos()&lt;br /&gt;
 &lt;br /&gt;
 childWindow.reposition(7,7)&lt;br /&gt;
 &lt;br /&gt;
 term.setCursorPos(lastX,lastY)&lt;br /&gt;
 xPos, yPos = childWindow.getPosition()&lt;br /&gt;
 print(&amp;quot;After moving the child window, it now registers as being at &amp;quot;..xPos..&amp;quot;x&amp;quot;..yPos..&amp;quot;.&amp;quot;)&lt;br /&gt;
|output=Notes that:&lt;br /&gt;
 Child window is initially at 2x2.&lt;br /&gt;
 After moving the parent window, child window still registers as being at 2x2.&lt;br /&gt;
 After moving the child window, it now registers as being at 7x7.&lt;br /&gt;
... and also displays the exclamation mark rendered within the child window (drawn at three different positions).&lt;br /&gt;
}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:API_Functions]]&lt;/div&gt;</summary>
		<author><name>Bomb Bloke</name></author>	</entry>

	</feed>