|
03/02/14, 07:15 AM | #1 |
Problem Traversing the Saved Variables Table
Okay,
I have set up my Saved Variables table as follows: Lua Code:
It then gets written to as follows: Lua Code:
But when I try and traverse the table as follows: Lua Code:
It seems to think it has the following data in there: GetInterfaceForCharacter : function : xxxxxxxx : (function) default : table : xxxxxxxx : (table) and despite having a table in there it doesn't traverse it further as expected, to see what else is hiding there. Is there a special way to traverse the Saved Variables table in ESO ? |
|
03/02/14, 01:50 PM | #2 |
I have written down that the first parameter passed to your function should be a string. So... "addonSV"
|
|
03/02/14, 02:29 PM | #3 | |
|
When your saved variables gets created it isn't blank. It stores the default values in a default table and GetInterfaceForCharacter is just a function there is in there. The default table is the same as SVDefault value, not sure what GetInterfaceForCharacter does, but it is in there all the same. I suggest using Zgoo to examine your saved variables. You can see exactly how it is laid out and see how it reacts when you change values in it. |
|
03/02/14, 02:47 PM | #4 | |
I guess it's confusing me why SVData is linked to the Data part of the table for writing but not for reading. The data is stored in the file as follows: ["Default"] ["@ACCOUNT"] ["$AccountWide"] ["Data"] ... data added by addon such as .. ["Khenarthi's Roost"] ["Aspect Rune"] [1] xPos = ... yPos = ... zone = ... etc when I use for index,value in pairs(SVData) do CHAT_SYSTEM:AddMessage(index,value,type(value)) end I am expecting the first element to be "Khenarthi's Roost", xxxxxx, table telling me to traverse down a level to receive the second as "Aspect Rune",xxxxx,table, with the third as "1",xxxx,table, and the fourth displaying the first set of actual values. However, if I say want to look for a specific item such as : local zoneData = SVData["Khanarthi's Roost"] local itemData = zoneData["Aspect Rune"] CHAT_SYSTEM:AddMessage(itemData[1].xPos,itemData[1].yPos) would display fine ( formatting aside that is ) |
||
03/02/14, 03:06 PM | #5 |
Looking at Esoheads Saved Variable table it looks like they do things differently so will try and do something similar with my addons.
Edit: Well after a lot of trial and error I finally almost had to copy what Esohead did and then adjust it to reflect my table contents. Ended up changing the layout of the Saved Variables File and spec Lua Code:
And using the way Esohead traversed through the table as a guide the following works flawlessly. Lua Code:
Last edited by Xrystal : 03/02/14 at 04:12 PM. |
|
03/02/14, 04:36 PM | #6 |
Okay, scratch the last reply.
It only works that way if I log in with an EMPTY!!!! Saved Variables table. Which totally defeats the point. If I log in with an empty table that games session will correctly traverse the table ( maybe without the need for adding the history header table but I am not spending another half hour changing it back now ) but the moment I tell it not to clear the table out the old traverse problem returns. By the way, what the heck is that version value for ? Should I set that to another value ? Can some bright spark see what the heck I am doing wrong here or is it a bug in the SavedVariables table? edit: As you can see this is annoying me to no end as I have wasted my beta weekend writing this addon and haven't been able to finish it because of this problem. Here is my code in its entirety barring the Update routine being called from the XML as per the norm. Lua Code:
Here is a screenshot of what is happening when I try and traverse through the table. If I change the traversing to the following in the hopes of bypassing the other stuff I get the same problem: Lua Code:
Again, only if the data exists when logging in. Last edited by Xrystal : 03/02/14 at 04:51 PM. |
|
03/02/14, 02:31 PM | #7 |
That's the name of my addon saved variable table.
I've been putting this at the top of my addons, to make things a bit easier: local addonName = "XrysGatherer" local addonVersion = "0.0.1" local addonSV = addonName.."_SavedVariables" In the gather addon it works out as "XrysGatherer_SavedVariables". That's why I don't get, writing to it works fine .. but reading from it seems to be a bit messed up unless you are looking for a specific element like I do to identify an existing element. |
|
ESOUI » Developer Discussions » Lua/XML Help » Problem Traversing the Saved Variables Table |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|