View Single Post
03/02/14, 02:47 PM   #5
Xrystal
caritas omnia vincit
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 369
Originally Posted by Errc View Post
addonSV is likely just a variable for whatever they named SV...

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.
But the question is why isn't it traversing it properly. Other tables work fine, just the saved variables one is messing up to the point of putting a stumbling block on me writing any addons that would need to access their respective tables.

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 )
  Reply With Quote