View Single Post
03/02/14, 03:06 PM   #6
Xrystal
caritas omnia vincit
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 369
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:
  1. local function InitSavedVariables(...)
  2.     SVData = {
  3.         ["History"] = ZO_SavedVars:NewAccountWide("XrysGatherer_SavedVariables", 1, "History", SVDefault)
  4.     }
  5.     SVDataIndex = 1
  6. end

And using the way Esohead traversed through the table as a guide the following works flawlessly.
Lua Code:
  1. ChatMsg:AddMessage("Traversing Harvest History")
  2.     for history,sv in pairs(SVData) do
  3.         ChatMsg:AddMessage(history)
  4.         if history == "History" then
  5.             for zone, t1 in pairs(SVData[history]) do
  6.                 for item, t2 in pairs(SVData[history][zone]) do
  7.                     for index, t3 in pairs(SVData[history][zone][item]) do
  8.                         local data = SVData[history][zone][item][index]
  9.                         ChatMsg:AddMessage(string.format("%d: %s %s in %s at %0.3f,%0.3f",index,item,tostring(data["Action"]),zone,data["X"],data["Y"]))
  10.                     end
  11.                 end
  12.             end
  13.         end
  14.     end

Last edited by Xrystal : 03/02/14 at 04:12 PM.
  Reply With Quote