The code you have should clear all the main frames including the combat log ( ChatFrame2 ).
For the temporary chat frames to get included this may be a better option.
FCFDock_GetChatFrames(dock) to receive a list of windows that are docked
DOCKED_CHAT_FRAMES is the table containing the docked chat frames.
So,
GENERAL_CHAT_DOCK.DOCKED_CHAT_FRAMES or
FCFDock_GetChatFrames(GENERAL_CHAT_DOCK) should get you the table containing the different chat frames in the chat frame box.
If you also have undocked windows that you want to access then this may be the better option.
Lua Code:
function WorkOnAllChatFrames()
local chatFrame, chatTab, conversationIcon;
for _, chatFrameName in pairs(CHAT_FRAMES) do
local frame = _G[chatFrameName];
chatFrame = frame;
chatTab = _G[chatFrame:GetName().."Tab"];
.... Do your stuff here
end
end
Also, to clear the tab of text simply set the Window Name to "". window:clear() will clear the chat frame window of its messages instead.
SetChatWindowName(i, "")