Unfortunately,
BreakUpLargeNumbers() only works on number values, not strings such as one returned by
GetCoinTextureString(). The following code will try to reformat an already formatted string. Note, don't try to use this on strings that contain numbers with a decimal component.
Lua Code:
function ReformatNumberString(str)
local repstr="%1"..LARGE_NUMBER_SEPERATOR.."%2";
-- Initial replacement of a number group at the end of the string
str=str:gsub("(%d)(%d%d%d)$",repstr));
-- Note repeat checks post-loop, unlike while that checks pre-loop
-- This not only guarantees the loop code to run at least once before the condition is checked, but allows use of locals inside the loop for the condition
repeat
-- Writing to an upvalue actually uses one additional opcode from just reregistering a local inside a loop
local numrep;
-- Looping replacement of a number group followed by a non-number
str,numrep=str:gsub("(%d)(%d%d%d%D)",repstr));
until numrep<=0
end