View Single Post
11/19/17, 03:39 PM   #1
Solinur
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 78
[implemented] Issues when saving/opening a lot of data to/from saved variables

Hi,

I wonder what the true and exact limits of saving data into saved variables are.

I played a bit around with a simple setting where I directly accessed the Global Variable defined in the Manifest file.
I managed to create a savedvar with 2.7 MB that gets corrupted upon loading by simply doing the following:

Lua Code:
  1. CombatMetricsFightData_Save = {}
  2.  
  3. for i = 1, entries do
  4.  
  5.     CombatMetricsFightData_Save[i] = true
  6.  
  7. end

if entries is bigger than 131072 the last and first entry become weird

Lua Code:
  1. [true] = true,
  2. ...
  3. ["CombatMetricsFightData_Save"] = true,

it uses its own handle and value as table key ...
This usually happens on load, when I check the file before loading I can see in a texteditor that everything is still fine.

If I save longer values e.g.

Lua Code:
  1. CombatMetricsFightData_Save[i] = tostring(math.random())

then the max number decreases to ~99.5k

Lua Code:
  1. CombatMetricsFightData_Save[i] = {i, "ABC"..i, math.random()}

can take about 52k

then again

Lua Code:
  1. CombatMetricsFightData_Save[i] = {1,2,3,4,5,6,7,8,9,10}
or a fixed string with 999 chars allow for 131k values again (in the latter case the file is 133 MB big, so its not the filesize...).

I would like to somehow make sure that I don't create corrupted saved variables (but still be able to save a lot of data).

It somehow feels like a bug to me, but it might be something that cannot be changed.

So if the restriction cannot be lifted, I at least would like to have a way to tell if my file will be fine or not.