API:TextLogGetUpdateEventId
From RoR Wiki
UI Lua API · TextLog functions
Version: WAR 1.4.8
Returns the ID of the event that fires when a text log changes.
eventId = TextLogGetUpdateEventId(logName)
Arguments
- logName
string– Name of the text log.
Returns
- eventId
number– Event ID to pass toRegisterEventHandler.
Details
- Every text log gets its own event ID when it is created.
- The handler receives two arguments:
updateTypeandfilterType.updateTypeis one ofSystemData.TextLogUpdate.ADDED(0),REMOVED(1) orCLEAR(2).- An entry added with TextLogAddEntry fires
ADDEDwith the entry's filter type. TextLogClear firesCLEAR.
- Entries dropped because the log is disabled do not fire the event.
Errors
Error in function call 'TextLogGetUpdateEventId': Text Log %s does not exist
Example
Flashing chat tabs on new text, from ea_chatwindow/source/chatwindow.lua:
local function RegisterTextLogUpdate( textLog )
-- Register text log update events so we can flash tabs
local chatLogEventId = TextLogGetUpdateEventId( textLog )
RegisterEventHandler( chatLogEventId, "EA_ChatWindow.OnTextLogUpdated" )
end
function EA_ChatWindow.OnTextLogUpdated( updateType, filterType )
if( updateType ~= SystemData.TextLogUpdate.ADDED )
then
return
end
...
end
