From 50db5dc5f6680f0bd29d23eb102de255d494164c Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Sat, 18 Aug 2007 23:44:00 +0000 Subject: [PATCH] Get the string, find the substring, compute the number of multibyte characters before it, and use that as the position of the attribute. --- .../ScreenInstructions overlay/default.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/stepmania/Themes/default/BGAnimations/ScreenInstructions overlay/default.lua b/stepmania/Themes/default/BGAnimations/ScreenInstructions overlay/default.lua index aa78f1f3c6..996ceffe26 100644 --- a/stepmania/Themes/default/BGAnimations/ScreenInstructions overlay/default.lua +++ b/stepmania/Themes/default/BGAnimations/ScreenInstructions overlay/default.lua @@ -79,21 +79,26 @@ elseif pm == 'PlayMode_Oni' then -- Merge the tables. t[3] = t[3] .. { InitCommand = function( self ) - local iStart, iLen = self:FindText( "Great", 0 ); + local sText = self:GetText(); + local iStart, iEnd = sText:find( "Great", 1, true ); if( iStart ~= nil ) then + iStart = iStart - 1; local attr = { - Length = iLen; + Length = iEnd - iStart; Diffuse = color( "#00F000" ); }; + iStart = mbstrlen( sText:sub(1, iStart) ); self:AddAttribute( iStart, attr ); end - iStart, iLen = self:FindText( "NG", 0 ); + iStart, iEnd = sText:find( "NG", 0 ); if( iStart ~= nil ) then + iStart = iStart - 1; local attr = { - Length = iLen; + Length = iEnd - iStart; Diffuse = color( "#F00000" ); }; + iStart = mbstrlen( sText:sub(1, iStart) ); self:AddAttribute( iStart, attr ); end end;