View Single Post
02/11/21, 05:51 AM   #7
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
Originally Posted by Kaozak View Post
That wouldn't be a problem, I had a working prototype. I've selected the messages via the ID (first parameter) and only modify the other parameters accordingly in those specific cases. After that, I called the base function, that handles the actual formatting of the modified parameters.
That's what you would think, but it makes quite a few differences (not just in this specific case).

By overwriting and running your own code before the original function, you are slowing it down compared to just leaving it alone. Most of the time not something you'd notice, but maybe some other code calls it a bazillion times in a loop and now it's twice as slow and suddenly people notice freezes with the combination of your addon and another one. Not something that most authors can easily debug.

Another huge difference is that any function touched (as in replaced) by an addon is marked as unsafe. When the game calls that function from a secure context, you suddenly get an error. Something like zo_strformat is called from literally anywhere in the game, so it's likely to fail in some situations. Really huge pain in the ass to find out why it suddenly does that, since the error can't tell you which addon is at fault. Can't tell you how many hours I wasted hunting down such bugs.

And depending on how your replacement operates, it may break in the future in case ZOS changes the signature of the function. Wouldn't be the first time that happens due to some addon naively overwriting some function.

So please don't say it wouldn't be a problem. You always gotta be careful when you change shared resources.
  Reply With Quote