Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:ModuleSetEnabled

From RoR Wiki

UI Lua API · Module functions
Version: WAR 1.4.8

Enables or disables a UI module (addon) by name.

ModuleSetEnabled(moduleName, enabled)

Arguments

moduleName
string – The module's name, as in the name field of ModulesGetData. The comparison is case-sensitive.
enabled
boolean – true to enable the module, false to disable it.

Returns

Nothing.

Details

  • Only the module's enabled flag is changed. A module that is already running is not shut down, and a newly enabled module is not initialized. The change takes effect the next time modules are initialized, which is why the stock UI reloads the interface right after calling it.
  • The flag is reported as isEnabled by ModulesGetData.
  • enabled must be a real boolean. Passing nil or a number raises an Invalid Parameters error.

Errors

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

  • Error in function call 'ModuleSetEnabled': %s is not a valid UiMod name.

Example

From ea_uimodwindow/source/uimodwindow.lua:

function UiModWindow.SaveAndReloadMods()

    WindowSetShowing( "UiModWindow", false )

    for index, modData in ipairs( UiModWindow.modsListData ) do
        ModuleSetEnabled( modData.name, modData.isEnabled  )
    end

    BroadcastEvent( SystemData.Events.RELOAD_INTERFACE )

end

See also