From 0a62529b55c4027b94cf1358a3480f5d23497b5d Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 20 Mar 2026 13:18:16 -0700 Subject: [PATCH] feat: add DEFAULT_CHAT_FRAME with AddMessage for addon output Many WoW addons use DEFAULT_CHAT_FRAME:AddMessage(text, r, g, b) to output colored text to chat. Implemented as a Lua table with AddMessage that converts RGB floats to WoW color codes and calls print(). Also aliased as ChatFrame1 for compatibility. Example: DEFAULT_CHAT_FRAME:AddMessage("Hello!", 1, 0.5, 0) --- src/addons/lua_engine.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/addons/lua_engine.cpp b/src/addons/lua_engine.cpp index d16ec26c..dc224549 100644 --- a/src/addons/lua_engine.cpp +++ b/src/addons/lua_engine.cpp @@ -917,6 +917,21 @@ void LuaEngine::registerCoreAPI() { " return ticker\n" "end\n" ); + + // DEFAULT_CHAT_FRAME with AddMessage method (used by many addons) + luaL_dostring(L_, + "DEFAULT_CHAT_FRAME = {}\n" + "function DEFAULT_CHAT_FRAME:AddMessage(text, r, g, b)\n" + " if r and g and b then\n" + " local hex = format('|cff%02x%02x%02x', " + " math.floor(r*255), math.floor(g*255), math.floor(b*255))\n" + " print(hex .. tostring(text) .. '|r')\n" + " else\n" + " print(tostring(text))\n" + " end\n" + "end\n" + "ChatFrame1 = DEFAULT_CHAT_FRAME\n" + ); } // ---- Event System ----