View Single Post
11/20/17, 07:54 PM   #13
Uesp
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 15
Originally Posted by decay2 View Post
If you use ZO_SavedVariables you use a few entries up for keys ("Default", "@Reorx" ... in your example) Then you have true as a value the rest goes into the numbered key of your table (1 to 131065) that way you fill up that number of constants to 2^17.
Yes...so as I understand it now there is a limit of 2^17 (131072) unique constants (number, string, true/false/nil) that a saved variable file can have in ESO before you run into corruption issues. Note that this includes constants in the entire file and not just in one array or nesting level which makes it a little more complicated to determine.

It's also non-obvious by just looking at the file sizes. For example, I have a 140MB file that only uses 50k constants while a 12MB file uses 120k constants. It matters more on how many unique constants you have rather than the actual file size.

It should be possible to count the number of constants in a saved variable from within the Lua API in ESO. Just find the root of the saved variable, iterate through it, and say all strings/numbers/true/false/nil into a table as keys, then count the number of keys in that table. At the very least it would let you know if you are getting close to the problem size.

I also don't have any idea why the problem occurs at 2^17 instead of 2^18 like it should according to the technical details. Offhand I'd guess a signed/unsigned issue but don't see any issue in the code itself and the Lua API code works fine up to 2^18 indicating some issue relating to ESO or the version of Lua it uses.