WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Overwrite SavedVariables and save them (https://www.wowinterface.com/forums/showthread.php?t=52375)

gempir 06-17-15 12:55 PM

Overwrite SavedVariables and save them
 
I want to change some Global Variables that get loaded from Skada. So that Skada takes over my exact Skada settings when my Addon gets loaded.

The problem is I don't know how to change the global Variables for Skada and change them permanently.

Something like
Lua Code:
  1. SkadaDB.profiles.Default.windows.x = -50

Is what I want to manipulate, but declaring it in my addon doesn't do anything.

Fizzlemizz 06-17-15 01:02 PM

Code:

SkadaDB.profiles.Default.windows[1].barslocked = true
SkadaDB.profiles.Default.windows[1].y = 0
SkadaDB.profiles.Default.windows[1].x = 0
SkadaDB.profiles.Default.windows[1].point = "BOTTOMRIGHT"
SkadaDB.profiles.Default.windows[1].barwidth = 182.171463012695
SkadaDB.profiles.Default.windows[1].hidden = true
if not SkadaDB.profiles.Default.windows[1].background then
                SkadaDB.profiles.Default.windows[1].background = {}
end
SkadaDB.profiles.Default.windows[1].background.height = 111.588340759277


gempir 06-17-15 01:08 PM

Thanks! It's working.

Could you explain why the [1] is there?

My WTF folder Skada.lua looks like this, so i don't get why its windows[1]



Edit: Now I'm getting the Error: "Your Computer does not have enough memory to load settings from the following AddOn. Please disable some AddOns "Skada"






Lua Code:
  1. SkadaDB = {
  2.     ["hasUpgraded"] = true,
  3.     ["profileKeys"] = {
  4.         ["Wraths - Proudmoore"] = "Default",
  5.     },
  6.     ["profiles"] = {
  7.         ["Default"] = {
  8.             ["windows"] = {
  9.                 {
  10.                     ["barheight"] = 12,
  11.                     ["classicons"] = false,
  12.                     ["barslocked"] = true,
  13.                     ["background"] = {
  14.                         ["color"] = {
  15.                             ["a"] = 0,
  16.                             ["b"] = 0.501960784313726,
  17.                         },
  18.                         ["height"] = 72,
  19.                     },
  20.                     ["set"] = "total",
  21.                     ["y"] = -207.999816894531,
  22.                     ["barfont"] = "Roboto",
  23.                     ["title"] = {
  24.                         ["texture"] = "flat",
  25.                     },
  26.                     ["point"] = "TOPRIGHT",
  27.                     ["mode"] = "Damage",
  28.                     ["x"] = -3,
  29.                     ["bartexture"] = "Flat",
  30.                     ["barwidth"] = 174,
  31.                     ["barbgcolor"] = {
  32.                         ["a"] = 0,
  33.                         ["b"] = 0,
  34.                         ["g"] = 0,
  35.                         ["r"] = 0,
  36.                     },
  37.                     ["barcolor"] = {
  38.                         ["b"] = 0.337254901960784,
  39.                         ["g"] = 0.337254901960784,
  40.                         ["r"] = 0.337254901960784,
  41.                     },
  42.                     ["enabletitle"] = false,
  43.                 }, -- [1]
  44.                 ["x"] = -50,
  45.             },
  46.             ["icon"] = {
  47.                 ["hide"] = true,
  48.             },
  49.             ["columns"] = {
  50.                 ["Damage_Damage"] = false,
  51.             },
  52.             ["hidedisables"] = false,
  53.             ["reset"] = {
  54.                 ["instance"] = 3,
  55.             },
  56.         },
  57.     },
  58. }

Choonstertwo 06-17-15 01:25 PM

Quote:

Originally Posted by gempir (Post 309183)
Could you explain why the [1] is there?

Lua Code:
  1. SkadaDB = {
  2.     ...
  3.     ["profiles"] = {
  4.         ["Default"] = {
  5.             ["windows"] = {
  6.                 {
  7.                     ["barheight"] = 12,
  8.                     ...
  9.                 }, -- [1]
  10.                 ["x"] = -50,
  11.             },
  12.             ...
  13.         },
  14.     },
  15. }

Notice that ["barheight"] = 12 is part of a table inside the windows table, the data isn't in the windows table itself. This inner table is at index 1 of the windows table.

When you put values without keys inside a table constructor, Lua will assign them consecutive integer keys starting from 1 (i.e. they're treated like values of an array). This is explained in more detail in the Reference Manual.

gempir 06-17-15 01:30 PM

Alright thanks! I didn't notice that at first.

But why am I getting this Error:

"Your Computer does not have enough memory to load settings from the following AddOn. Please disable some AddOns "Skada"

Choonstertwo 06-17-15 01:41 PM

Quote:

Originally Posted by gempir (Post 309185)
Alright thanks! I didn't notice that at first.

But why am I getting this Error:

"Your Computer does not have enough memory to load settings from the following AddOn. Please disable some AddOns "Skada"

Some AddOn's SavedVariables file (it may or may not be Skada's) is taking up a large amount of memory when loaded so WoW ran out of memory when trying to load Skada's SavedVariables file. Does it happen if you only run Skada and your own AddOn?

gempir 06-17-15 01:52 PM

I deleted my WTF folder and now the Error doesn't appear anymore. No clue why though.

I was only running my addon + Skada

My addon only uses 1 saved variable.

Fizzlemizz 06-17-15 01:54 PM

Possibly your original changes to SkadaDB.profiles.Default.windows.x = yada messed something up.

rowaasr13 06-24-15 11:34 AM

You've probably made a cyclic reference somewhere while messing with variables to be saved and caused WoW to generate huge dump that got truncated on next load.


All times are GMT -6. The time now is 10:06 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI