View Single Post
03/02/14, 07:37 PM   #9
Xrystal
caritas omnia vincit
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 369
Well 2 hrs or so later, finally got it figured... whew. Now I am happy and not the sulky bitch I was before rofl.

This is how I managed to access the saved variables in it's entirety. The local SVData file is only the contents of that session as it only works if you clear the tables when the addon is loaded, but the contents of XrysGatherer_SavedVariables is the whole data.

This means I may be able to go back to the old version and use this code anyway and not have to fix the data everyone has been gathered so far.

Unfortunately at 1:30am I doubt I'll be doing anything else this beta weekend except to test that the original version can traverse properly this way too and when I want to rather than only after it has been updated which is what it is currently doing and upload a working version of that.

Lua Code:
  1. ChatMsg:AddMessage("Traversing Saved Variables")
  2.     harvestHistory = {}
  3.     for default,sv in safepairs(XrysGatherer_SavedVariables) do
  4.         for account,accountv in safepairs(sv) do
  5.             for accountWide,acWideV in safepairs(accountv) do
  6.                 for history,historyV in safepairs(acWideV) do
  7.                     if history == "History" then
  8.                         table.insert(harvestHistory,historyV )
  9.                     end
  10.                 end
  11.             end
  12.         end
  13.     end
  14.  
  15.     ChatMsg:AddMessage("Traversing Harvest History")
  16.     for historyIndex,historyData in safepairs(harvestHistory) do
  17.         for zoneIndex,zoneData in safepairs(historyData) do
  18.             if zoneIndex ~= "version" then
  19.                 for itemIndex,itemData in safepairs(zoneData) do
  20.                     for indexIndex,indexData in safepairs(itemData) do
  21.                         ChatMsg:AddMessage(string.format("%s %s in %s at %0.3f,%0.3f",itemIndex,tostring(indexData["Action"]),zoneIndex,indexData["X"],indexData["Y"]))
  22.                     end
  23.                 end
  24.             end
  25.         end
  26.     end
  Reply With Quote