Thread Tools Display Modes
Prev Previous Post   Next Post Next
03/02/14, 07:15 AM   #1
Xrystal
caritas omnia vincit
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 369
Problem Traversing the Saved Variables Table

Okay,

I have set up my Saved Variables table as follows:

Lua Code:
  1. local function InitSavedVariables(...)
  2.     SVData = ZO_SavedVars:NewAccountWide(addonSV, 1, "Data", SVDefault)
  3.     SVDataIndex = 1
  4. end

It then gets written to as follows:

Lua Code:
  1. SVData = SVData or {}
  2. SVData[zone] = SVData[zone] or {}
  3. SVData[zone][name] = SVData[zone][name] or {}
  4. SVDataIndex = #SVData[zone][name] + 1
  5. SVData[zone][name][SVDataIndex] = SVData[zone][name][SVDataIndex] or {}
  6. SVData[zone][name][SVDataIndex]["Action"] = action
  7. SVData[zone][name][SVDataIndex]["X"] = xPos
  8. SVData[zone][name][SVDataIndex]["Y"] = yPos
  9. SVData[zone][name][SVDataIndex]["Date"] = dateValue
  10. SVData[zone][name][SVDataIndex]["Time"] = timeValue

But when I try and traverse the table as follows:
Lua Code:
  1. local function RecurseSavedVariables(...)
  2.   -- Zone
  3.   for i,v in pairs(SVData) do
  4.     ChatMsg:AddMessage(string.format("(i,v) - %s : %s (%s)",tostring(i),tostring(v),type(v)))
  5.     if ( type(v) == "table" ) then
  6.       -- Name
  7.       for i2,v2 in pairs(v) do
  8.         ChatMsg:AddMessage(string.format("(i2,v2) - %s : %s (%s)",tostring(i2),tostring(v2),type(v2)))
  9.         if (type(v2) == "table") then
  10.           -- Values
  11.           for i3,v3 in pairs(v2) do
  12.             ChatMsg:AddMessage(string.format("(i3,v3) - %s : %s (%s)",tostring(i3),tostring(v3),type(v3)))
  13.           end
  14.         end
  15.       end
  16.     end
  17.   end
  18. end

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

ESOUI » Developer Discussions » Lua/XML Help » Problem Traversing the Saved Variables Table


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off