View Single Post
02/02/22, 05:56 PM   #4
Gullyable
Join Date: Apr 2018
Posts: 13
Thanks for info!

I was totally thinking about changing it to a lookup table using the value as index. It's a trivial change, too.

And good point on the global redefs.

Originally Posted by sirinsidiator View Post
You can find the latest file for live at this url: https://github.com/esoui/esoui/blob/...umentation.txt
It's usually updated within a few hours after a new doc file becomes available, which sometimes can take a day or so after the update goes live.

As for file size limit there is no real limit (technically there is, but it's astronomically big). Bigger files have a direct impact on login time and at some point you will get kicked by the server before you can load into the game. 1MB should be fine though, considering some saved variable files are several hundreds of MB in size.

Just a heads up, it looks like you are redefining the variables globally in your file. That's something you should avoid doing because it will break the game on an update in case the constants change their value. Other addons did similar things in the past and it always ends up being a huge hard to debug mess when users complain to author A about some issue and it turns out author B did something they shouldn't have done.

On another note, you can simplify the code by using a lookup table like this:

Lua Code:
  1. local CURRENCY_CHANGE_REASON_STRINGS = {
  2.     [0] = "CURRENCY_CHANGE_REASON_ABILITY_UPGRADE_PURCHASE",
  3.     [1] = "CURRENCY_CHANGE_REASON_ACHIEVEMENT",
  4.     -- all the other values
  5.     [79] = "CURRENCY_CHANGE_REASON_VENDOR_REPAIR",
  6. }
  7.  
  8. function CurrencyChangeReason_get_string(value)
  9.     return CURRENCY_CHANGE_REASON_STRINGS[value] or tostring(value)
  10. end
Should take up less space and run faster.
  Reply With Quote