From c8ab5e1f091970fc46d9bd417f8998635a22eead Mon Sep 17 00:00:00 2001 From: fallenoak Date: Wed, 10 Dec 2025 23:17:19 -0600 Subject: [PATCH] feat(ui): implement CSimpleFontString_SetFormattedText --- src/ui/simple/CSimpleFontStringScript.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ui/simple/CSimpleFontStringScript.cpp b/src/ui/simple/CSimpleFontStringScript.cpp index bcae9b1..57893eb 100644 --- a/src/ui/simple/CSimpleFontStringScript.cpp +++ b/src/ui/simple/CSimpleFontStringScript.cpp @@ -175,7 +175,19 @@ int32_t CSimpleFontString_SetText(lua_State* L) { } int32_t CSimpleFontString_SetFormattedText(lua_State* L) { - WHOA_UNIMPLEMENTED(0); + auto type = CSimpleFontString::GetObjectType(); + auto string = static_cast(FrameScript_GetObjectThis(L, type)); + + if (!string->m_font) { + return luaL_error(L, "%s:SetFormattedText(): Font not set", string->GetDisplayName()); + } + + char buffer[4096]; + auto text = FrameScript_Sprintf(L, 2, buffer, sizeof(buffer)); + + string->SetText(text, 1); + + return 0; } int32_t CSimpleFontString_GetTextColor(lua_State* L) {