View Single Post
09-02-12, 07:10 AM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by myrroddin View Post
You shouldn't be editing strings, as that creates all kinds of problems. ... If you edit the global strings in any way, shape, or form, yes, you will crash because the game expects something, but you changed it, so boom.
I'm not sure what strings you've been editing, or what you've been doing to them, but changing a string is perfectly safe. The only caveat is that if the string contains substitution tokens -- things like %s or %d or %2$s -- you need to make sure that your new string also contains all of those tokens, in the same order. Well, it's okay to switch up the order if the tokens are all %1$s and %2$d types, but if they are plain %s %d %0.1f they must be in the same order.

If the tokens are missing, or in the wrong order, then the values being passed to Lua functions like string.format -- or their C equivalents -- are incorrect. If the values are being handled in Lua (eg. the game's FrameXML code, or another addon) then you should get a Lua error. If the values are being handled in C (eg. populating the tooltip with unit data) then you may well crash the client, though you should report such crashes to Blizzard so they can fix them.

If you want to get rid of some part of the string that includes a substitution token, you'll need to find another way to do it. For example, if the final, formatted string is shown in the chat frame, you should use the chat filtering API to remove the unwanted parts. Same goes if you want to change the order in which tokens appear.

Check your strings against Blizzard's current global strings for your game client's locale, and make sure your tokens are all correct.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote