<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AWindowGetAnchor</id>
	<title>API:WindowGetAnchor - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AWindowGetAnchor"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:WindowGetAnchor&amp;action=history"/>
	<updated>2026-10-18T04:53:37Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.returnofreckoning.com/index.php?title=API:WindowGetAnchor&amp;diff=30867&amp;oldid=prev</id>
		<title>Maintenance script: UI Lua API import (WAR 1.4.8)</title>
		<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:WindowGetAnchor&amp;diff=30867&amp;oldid=prev"/>
		<updated>2026-10-16T19:51:26Z</updated>

		<summary type="html">&lt;p&gt;UI Lua API import (WAR 1.4.8)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{LuaApi|group=Window}}&lt;br /&gt;
Returns one of a window&amp;#039;s anchors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
point, relativePoint, relativeTo, xOffset, yOffset = WindowGetAnchor(windowName, anchorIndex)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
;windowName : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Name of the window.&lt;br /&gt;
;anchorIndex : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – Which anchor to read, starting at 1.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
;point : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Point on the relative window, for example &amp;lt;code&amp;gt;&amp;quot;bottomleft&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
;relativePoint : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Point on this window.&lt;br /&gt;
;relativeTo : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Name of the window the anchor is attached to.&lt;br /&gt;
;xOffset, yOffset : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – The anchor&amp;#039;s offsets.&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* The order differs from [[API:WindowAddAnchor|WindowAddAnchor]], which takes &amp;lt;code&amp;gt;relativeTo&amp;lt;/code&amp;gt; before &amp;lt;code&amp;gt;relativePoint&amp;lt;/code&amp;gt;. Copy an anchor with &amp;lt;code&amp;gt;WindowAddAnchor(name, point, relativeTo, relativePoint, xOffset, yOffset)&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Anchors are counted in the order they were added. [[API:WindowGetAnchorCount|WindowGetAnchorCount]] gives the number of anchors.&lt;br /&gt;
* &amp;lt;code&amp;gt;anchorIndex&amp;lt;/code&amp;gt; is truncated to a whole number.&lt;br /&gt;
* A point name the client did not recognise when the anchor was added is returned as &amp;lt;code&amp;gt;&amp;quot;none&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
* If the anchor has no relative window name, the name of the window&amp;#039;s parent is returned instead. For a window without a parent, an empty &amp;#039;&amp;#039;&amp;#039;wide&amp;#039;&amp;#039;&amp;#039; string (&amp;lt;code&amp;gt;L&amp;quot;&amp;quot;&amp;lt;/code&amp;gt;) is returned in that case.&lt;br /&gt;
* The function needs at least two arguments and only reads the last two.&lt;br /&gt;
&lt;br /&gt;
== Errors ==&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;WindowGetAnchor&amp;#039;&amp;lt;/code&amp;gt;&amp;lt;br/&amp;gt;Raised both when the window does not exist and when &amp;lt;code&amp;gt;anchorIndex&amp;lt;/code&amp;gt; is less than 1 or greater than the number of anchors. The message does not say which.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Copying all anchors from one window to another with an extra offset, from &amp;lt;code&amp;gt;easystem_layouteditor/source/layouteditorutils.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WindowClearAnchors( destinationWindow )&lt;br /&gt;
&lt;br /&gt;
local numAnchors = WindowGetAnchorCount( sourceWindow )&lt;br /&gt;
for index = 1, numAnchors&lt;br /&gt;
do&lt;br /&gt;
    local point, relativePoint, relativeTo, xoffs, yoffs = WindowGetAnchor( sourceWindow, index )&lt;br /&gt;
    WindowAddAnchor( destinationWindow , point, relativeTo, relativePoint, xoffs+xOffset, yoffs+yOffset )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:WindowGetAnchorCount|WindowGetAnchorCount]]&lt;br /&gt;
* [[API:WindowAddAnchor|WindowAddAnchor]]&lt;br /&gt;
* [[API:WindowClearAnchors|WindowClearAnchors]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>