Thread: SellAllJunk()
View Single Post
12/17/14, 07:50 AM   #2
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
When you click button in the dialog, it calls callback function. As you can see, callback is a copy of SellAllJunk function. Dialog was defined before you have redefined SellAllJunk and it means that callback is a copy of the original function.
To make it work just update callback function after SeallAllJunk is redefined.
Lua Code:
  1. local OrigSellAllJunk = SellAllJunk
  2. function SellAllJunk()
  3.     d("SellAllJunk")
  4. end
  5.  
  6. ESO_Dialogs.SELL_ALL_JUNK.buttons[1].callback = SellAllJunk


Just a note:
If you assign vairable1 = variable2, you always creating a copy of the variable's value. This is true for, numbers, strings, ... and even for functions. There are only two exceptions - "table" and "userdata". It is because those two types of variables does not hold the value but reference (or pointer) to the object in memory. So if you assign table1 = table2, you are copying just reference to the object, not object itself.

Last edited by Garkin : 12/17/14 at 08:09 AM.
  Reply With Quote