feat(ui): implement CSimpleFontString_SetFormattedText

This commit is contained in:
fallenoak 2025-12-10 23:17:19 -06:00
parent d1b08b59b1
commit c8ab5e1f09
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D

View File

@ -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<CSimpleFontString*>(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) {