Thread: SavedVars
View Single Post
06/08/18, 08:48 PM   #1
Tarlac
 
Tarlac's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2018
Posts: 10
SavedVars

Hello Folks.

I am creating an addon and I have run into a little issue. What I am trying to do is access the data in my saved file and display it on which ever character is logged in. I can access my current characters data fine but I am unsure how to load up the values from my other characters. Here is a simple example..


Lua Code:
  1. MyAddonSavedVariables =
  2. {
  3.     ["Default"] =
  4.     {
  5.         ["@Tarlac"] =
  6.         {
  7.             ["Tarlac Sorc"] =
  8.             {
  9.                 ["OffsetX"] = 1274,
  10.                 ["OffsetY"] = 378,
  11.                 ["name"] = "Tarlac Sorc",
  12.                 ["gold"] = 337,
  13.                 ["version"] = 2,
  14.             },
  15.             ["Tarlac Night"] =
  16.             {
  17.                 ["OffsetX"] = 1354,
  18.                 ["OffsetY"] = 155,
  19.                 ["name"] = "Tarlac Night",
  20.                 ["gold"] = 9400,
  21.                 ["version"] = 8,
  22.             },
  23.             ["Tarlac Ramos"] =
  24.             {
  25.                 ["OffsetX"] = 483,
  26.                 ["OffsetY"] = 675,
  27.                 ["version"] = 2,
  28.                 ["gold"] = 21853,
  29.                 ["name"] = "Tarlac Ramos",
  30.             },
  31.         },
  32.     },
  33. }

What I am trying to do is just create a string from this data that I can display on screen.
The string would be something like

Tarlac Sorc = 337
Tarlac Night = 9400
Tarlac Ramos = 21853

The I would display this data in my addon. I can access my current character, but I have not figured out how to access the other characters. Does anyone have any suggestions on where I would begin?

Thanks. Tarlac.
  Reply With Quote