ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Issue with multiple Saved Vars in 1 metafile (https://www.esoui.com/forums/showthread.php?t=6352)

Ayantir 06/12/16 09:01 AM

Issue with multiple Saved Vars in 1 metafile
 
Hello,

In one of the project I have, I got multiple saved vars.

There declared as is :

Lua Code:
  1. ## SavedVariables: POSTMAIL_DEAMON DATAMINED_DATA DATAMINED_BOOKS DUMPING_DEAMON eideticReverse eideticHomonym

DATAMINED_DATA DATAMINED_BOOKS are a bit linked together.

DATAMINED_DATA is built by a function, no problem.


Then I got another function, which does this :

Lua Code:
  1. DATAMINED_BOOKS = DATAMINED_DATA

then DATAMINED_BOOKS is altered several times

When saving, changes are repercuted in both variables.

This first issue is easy to handle, because both variables (two arrays of hundreds of thousands of lines) are equal..




Another issue is with eideticReverse eideticHomonym

eideticReverse is linked to a slash command, the array is built.
eideticHomonym is linked to a another slash command, the array is built.

eideticReverse & eideticHomonym are in the same Lua file but each one got its own function they don't have anything in relation, except being in the same Lua file and the metafile.


When I run the function which build eideticHomonym, 1 column is written in eideticReverse variable and so the code is totally faked.


the possibilities for me are to change the metafile (remove one of the 2 vars) before executing code in order to avoid this, Or merge the whole data into one super array, like ZO_Ingame does.

If its a known bug, or something.

The var POSTMAIL_DAEMON is built from datamining since months, and I wouldn't lost it due to this issue ...

PS: I don't use the ZO_SavedVars object.

Randactyl 06/12/16 09:30 AM

Lua Code:
  1. DATAMINED_BOOKS = DATAMINED_DATA

Just gives you another way to look up the table pointed to by DATAMINED_DATA.

If you want to make a copy of DATAMINED_DATA into DATAMINED_BOOKS and then do operations on it, use either ZO_ShallowTableCopy or ZO_DeepTableCopy. Iirc, the deep copy preserves any metatables while shallow only copies the actual data. (I think you knew this, just expanding for completeness).

As for the other issue, I'd have to monkey around with it to see for myself and I dont have time today :banana:

merlight 06/12/16 02:16 PM

Quote:

Originally Posted by Ayantir (Post 27395)
This first issue is easy to handle, because both variables (two arrays of hundreds of thousands of lines) are equal..

You may be hitting the hard limit of ~262k constants per file. It can be saved, but not loaded properly.
http://www.esoui.com/forums/showpost...5&postcount=33
http://www.lua.org/source/5.1/lcode.c.html#addk
http://www.lua.org/source/5.1/lopcodes.h.html#SIZE_Bx


All times are GMT -6. The time now is 09:18 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI