View Single Post
05/22/14, 11:51 AM   #13
ingeniousclown
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 122
Judging from your most recent reply, I'm guessing that you have something along the lines of this:

lua Code:
  1. defaults = {
  2.     x = someNumber,
  3.     y = someOtherNumber
  4. }
  5. settings = defaults
  6.  
  7. control:ClearAnchors()
  8. control:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, defaults.x, defaults.y)
  9.  
  10. --control is moved?
  11.  
  12. settings.x = newNumber
  13. settings.y = newOtherNumber
  14.  
  15. control:ClearAnchors()
  16. control:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, defaults.x, defaults.y)

Can you see the problem? Tables are not copied upon assignment, they are referenced.

So "settings = defaults" and then "settings.x = someNewNumber" in fact changes the value of your "defaults.x".
  Reply With Quote