Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:TextLogSetFilterEnabled

From RoR Wiki

UI Lua API · TextLog functions
Version: WAR 1.4.8

Turns one filter type of a text log on or off.

TextLogSetFilterEnabled(logName, filterType, enabled)

Arguments

logName
string – Name of the text log.
filterType
number – A filter type registered with TextLogAddFilterType. Fractions are dropped.
enabled
boolean – true to turn the filter type on, false to turn it off.

Returns

Nothing.

Details

  • The flag is stored on the log's entry for that filter type. If the filter type is not registered on the log, nothing happens and no error is logged.
  • This is a flag of the text log itself, not of a display. To show or hide a filter type in one LogDisplay use LogDisplaySetFilterState. The stock debug window sets both; its comment says "When UI Log filters are off, disable logging of that filter type entirely."
  • enabled must be a real boolean. Passing nil or a number raises an Invalid Parameters error.
  • The function needs at least three arguments and only reads the last three.

Errors

This is written to the UI log; the call returns normally.

  • Error in function call 'TextLogSetFilterEnabled': Text Log %s does not exist

Example

From ea_uidebugtools/source/debugwindow.lua:

local enabled = not DebugWindow.Settings.LogFilters[filterId].enabled
DebugWindow.Settings.LogFilters[filterId].enabled = enabled

ButtonSetPressedFlag( "DebugWindowOptionsFilterType"..filterId.."Button", enabled )
LogDisplaySetFilterState( "DebugWindowText", "UiLog", filterId, enabled )

-- When UI Log filters are off, disable logging of that filter type entirely.
TextLogSetFilterEnabled( "UiLog", filterId, enabled )

See also