Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:ModulesLoadFromDirectory

From RoR Wiki

UI Lua API · Module functions
Version: WAR 1.4.8

Loads the definitions of all UI modules (.mod files) found under a folder on disk.

ModulesLoadFromDirectory(directory, moduleType)

Arguments

directory
wstring – Folder to search, for example L"interface/MythicApprovedAddOns" or SystemData.Directories.AddOnsInterface. It must be a wide string.
moduleType
number – A SystemData.UiModuleType value from 1 to 5. Every module found is given this type.

Returns

Nothing.

Details

  • The folder must exist on disk; folders inside the game archives are not searched.
  • The modules are only registered with the client. Call ModulesInitializeAllEnabled afterwards to run them.
  • The type is what ModulesGetData reports as moduleType; nothing in the .mod file sets it.
  • directory must be a wide string, or an Invalid Parameters error is raised.

Errors

These are written to the UI log; the call returns normally.

  • Error in function call 'ModulesLoadFromDirectory': No directory specified
  • Error in function call 'ModulesLoadFromDirectory': Directory path %ls does not exist
  • Error in function call 'ModulesLoadFromDirectory': Module Type %d is invalid.

Example

From interfacecore/interfacecore.lua:

ModulesLoadFromDirectory( SystemData.Directories.AddOnsInterface, SystemData.UiModuleType.USER_ADDON  )

Loading a custom UI and checking that it contained at least one module, also from interfacecore/interfacecore.lua:

ModulesLoadFromDirectory( SystemData.Directories.CustomInterface, SystemData.UiModuleType.CUSTOM_INGAME  )

-- Ensure atleast one .mod file was found
local modsData = ModulesGetData()
if( modsData[1] == nil )
then
    return false
end

See also