<?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%3AWindowSetLayer</id>
	<title>API:WindowSetLayer - 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%3AWindowSetLayer"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:WindowSetLayer&amp;action=history"/>
	<updated>2026-10-18T04:52:58Z</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:WindowSetLayer&amp;diff=30900&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:WindowSetLayer&amp;diff=30900&amp;oldid=prev"/>
		<updated>2026-10-16T19:51:55Z</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;
Sets the layer a window is drawn on, relative to its siblings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WindowSetLayer(windowName, layer)&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;
;layer : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – New layer. Use one of the &amp;lt;code&amp;gt;Window.Layers&amp;lt;/code&amp;gt; constants below.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
Nothing.&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* The client defines these constants:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Constant !! Value&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;Window.Layers.BACKGROUND&amp;lt;/code&amp;gt; || 0&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;Window.Layers.DEFAULT&amp;lt;/code&amp;gt; || 1&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;Window.Layers.SECONDARY&amp;lt;/code&amp;gt; || 2&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;Window.Layers.POPUP&amp;lt;/code&amp;gt; || 3&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;Window.Layers.OVERLAY&amp;lt;/code&amp;gt; || 4&lt;br /&gt;
|}&lt;br /&gt;
* Layers only order a window against its siblings (windows with the same parent). Siblings on a higher layer are drawn in front.&lt;br /&gt;
* The window is moved in its parent&amp;#039;s child list to the front of the siblings on its new layer. Calling the function with the window&amp;#039;s current layer therefore also raises it within that layer.&lt;br /&gt;
* &amp;lt;code&amp;gt;layer&amp;lt;/code&amp;gt; is truncated to a whole number and stored in one byte, so values outside 0–255 wrap around. The value is not checked against the constants.&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;WindowSetLayer&amp;#039;: Window %s does not exist&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;WindowSetLayer&amp;#039;: Window %s is currently locked and may not be modified from lua. ...&amp;lt;/code&amp;gt;&amp;lt;br/&amp;gt;This check never triggers in the current client. See [[API:WindowSetShowing|WindowSetShowing]].&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
From &amp;lt;code&amp;gt;ea_scenariosummarywindow/scenariosummarywindow.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-- Move the window to the overlay layer when in loading mode&lt;br /&gt;
if( inLoadingMode ) then&lt;br /&gt;
    WindowSetLayer(&amp;quot;ScenarioSummaryWindow&amp;quot;, Window.Layers.OVERLAY )&lt;br /&gt;
    -- ...&lt;br /&gt;
else&lt;br /&gt;
    WindowSetLayer(&amp;quot;ScenarioSummaryWindow&amp;quot;, Window.Layers.SECONDARY )&lt;br /&gt;
    -- ...&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:WindowGetLayer|WindowGetLayer]]&lt;br /&gt;
* [[API:WindowSetPopable|WindowSetPopable]]&lt;br /&gt;
* [[API:WindowSetParent|WindowSetParent]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>