<?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%3ASetTextureImage</id>
	<title>API:SetTextureImage - 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%3ASetTextureImage"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:SetTextureImage&amp;action=history"/>
	<updated>2026-10-17T14:21:41Z</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:SetTextureImage&amp;diff=30737&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:SetTextureImage&amp;diff=30737&amp;oldid=prev"/>
		<updated>2026-10-16T19:49:18Z</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=Interface}}&lt;br /&gt;
Loads a new image file into an existing UI texture.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
success = SetTextureImage(textureName, imagePath)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
;textureName : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Name of a texture already defined by the UI, for example in a &amp;lt;code&amp;gt;&amp;amp;lt;Texture&amp;amp;gt;&amp;lt;/code&amp;gt; element of a module&amp;#039;s XML.&lt;br /&gt;
;imagePath : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Path of the image file, relative to the folder of the UI module that is current when the call is made.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
;success : &amp;lt;code&amp;gt;boolean&amp;lt;/code&amp;gt; – &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if the image was loaded and assigned to the texture.&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* The client must have a current UI module, otherwise the &amp;#039;&amp;#039;must be called from a UI module&amp;#039;&amp;#039; error is logged. The full path is built as &amp;#039;&amp;#039;module folder&amp;#039;&amp;#039;&amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt;&amp;#039;&amp;#039;imagePath&amp;#039;&amp;#039;.&lt;br /&gt;
* If no texture named &amp;lt;code&amp;gt;textureName&amp;lt;/code&amp;gt; exists, or the image file does not exist, the matching error is logged and &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; is returned.&lt;br /&gt;
* In the stock example the path &amp;lt;code&amp;gt;Textures/english/...&amp;lt;/code&amp;gt; points into the &amp;lt;code&amp;gt;ea_helpwindow&amp;lt;/code&amp;gt; module&amp;#039;s own folder.&lt;br /&gt;
* The argument check is shared with [[API:DynamicImageSetTexture|DynamicImageSetTexture]]: if an argument is missing or not a string, the &amp;#039;&amp;#039;Invalid Parameters&amp;#039;&amp;#039; message names that function.&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;
These are written to the UI log; the call returns &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;SetTextureImage&amp;#039;: This function must be called from a UI module&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;SetTextureImage&amp;#039;: Texture %s does not exist&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;SetTextureImage&amp;#039;: Image file %s does not exist&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Loading a localised tutorial picture and falling back to English, from &amp;lt;code&amp;gt;ea_helpwindow/source/tutorialwindow.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
local function GetTextureFilePath( lang )&lt;br /&gt;
    local langDir = InterfaceCore.CoreLanguageDirectories[ lang ]&lt;br /&gt;
    return &amp;quot;Textures/&amp;quot;..langDir..&amp;quot;/&amp;quot;..textureFileName&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- First try to load the localized image&lt;br /&gt;
local success = SetTextureImage( &amp;quot;EA_Help_Tutorial_Background1&amp;quot;, GetTextureFilePath( SystemData.Settings.Language.active ) )&lt;br /&gt;
if( success == false )&lt;br /&gt;
then&lt;br /&gt;
    -- Otherwise fallback on the English image&lt;br /&gt;
    SetTextureImage( &amp;quot;EA_Help_Tutorial_Background1&amp;quot;, GetTextureFilePath( SystemData.Settings.Language.ENGLISH ) )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:DynamicImageSetTexture|DynamicImageSetTexture]]&lt;br /&gt;
* [[API:LoadResources|LoadResources]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>