<?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%3AModulesLoadFromDirectory</id>
	<title>API:ModulesLoadFromDirectory - 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%3AModulesLoadFromDirectory"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:ModulesLoadFromDirectory&amp;action=history"/>
	<updated>2026-10-18T06:58:43Z</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:ModulesLoadFromDirectory&amp;diff=30612&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:ModulesLoadFromDirectory&amp;diff=30612&amp;oldid=prev"/>
		<updated>2026-10-16T19:47:21Z</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=Module}}&lt;br /&gt;
Loads the definitions of all UI modules (&amp;lt;code&amp;gt;.mod&amp;lt;/code&amp;gt; files) found under a folder on disk.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ModulesLoadFromDirectory(directory, moduleType)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
;directory : &amp;lt;code&amp;gt;wstring&amp;lt;/code&amp;gt; – Folder to search, for example &amp;lt;code&amp;gt;L&amp;quot;interface/MythicApprovedAddOns&amp;quot;&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;SystemData.Directories.AddOnsInterface&amp;lt;/code&amp;gt;. It must be a wide string.&lt;br /&gt;
;moduleType : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – A &amp;lt;code&amp;gt;SystemData.UiModuleType&amp;lt;/code&amp;gt; value from 1 to 5. Every module found is given this type.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
Nothing.&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* The folder must exist on disk; folders inside the game archives are not searched.&lt;br /&gt;
* The modules are only registered with the client. Call [[API:ModulesInitializeAllEnabled|ModulesInitializeAllEnabled]] afterwards to run them.&lt;br /&gt;
* The type is what [[API:ModulesGetData|ModulesGetData]] reports as &amp;lt;code&amp;gt;moduleType&amp;lt;/code&amp;gt;; nothing in the &amp;lt;code&amp;gt;.mod&amp;lt;/code&amp;gt; file sets it.&lt;br /&gt;
* &amp;lt;code&amp;gt;directory&amp;lt;/code&amp;gt; must be a wide string, or an &amp;#039;&amp;#039;Invalid Parameters&amp;#039;&amp;#039; error is raised.&lt;br /&gt;
&lt;br /&gt;
== Errors ==&lt;br /&gt;
These are written to the UI log; the call returns normally.&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;ModulesLoadFromDirectory&amp;#039;: No directory specified&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;ModulesLoadFromDirectory&amp;#039;: Directory path %ls does not exist&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;ModulesLoadFromDirectory&amp;#039;: Module Type %d is invalid.&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
From &amp;lt;code&amp;gt;interfacecore/interfacecore.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ModulesLoadFromDirectory( SystemData.Directories.AddOnsInterface, SystemData.UiModuleType.USER_ADDON  )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Loading a custom UI and checking that it contained at least one module, also from &amp;lt;code&amp;gt;interfacecore/interfacecore.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ModulesLoadFromDirectory( SystemData.Directories.CustomInterface, SystemData.UiModuleType.CUSTOM_INGAME  )&lt;br /&gt;
&lt;br /&gt;
-- Ensure atleast one .mod file was found&lt;br /&gt;
local modsData = ModulesGetData()&lt;br /&gt;
if( modsData[1] == nil )&lt;br /&gt;
then&lt;br /&gt;
    return false&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:ModulesLoadFromListFile|ModulesLoadFromListFile]]&lt;br /&gt;
* [[API:ModuleLoad|ModuleLoad]]&lt;br /&gt;
* [[API:ModulesInitializeAllEnabled|ModulesInitializeAllEnabled]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>