Thread Tools Display Modes
06-17-15, 12:55 PM   #1
gempir
A Black Drake
 
gempir's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2015
Posts: 84
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.
  Reply With Quote
06-17-15, 01:02 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,857
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
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
06-17-15, 01:08 PM   #3
gempir
A Black Drake
 
gempir's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2015
Posts: 84
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. }

Last edited by gempir : 06-17-15 at 01:25 PM.
  Reply With Quote
06-17-15, 01:25 PM   #4
Choonstertwo
A Chromatic Dragonspawn
 
Choonstertwo's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 194
Originally Posted by gempir View Post
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.

Last edited by Choonstertwo : 06-17-15 at 01:25 PM. Reason: Wrong font
  Reply With Quote
06-17-15, 01:30 PM   #5
gempir
A Black Drake
 
gempir's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2015
Posts: 84
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"
  Reply With Quote
06-17-15, 01:41 PM   #6
Choonstertwo
A Chromatic Dragonspawn
 
Choonstertwo's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 194
Originally Posted by gempir View Post
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?
  Reply With Quote
06-24-15, 11:34 AM   #7
rowaasr13
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 27
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.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Overwrite SavedVariables and save them

Thread Tools
Display Modes

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