View Single Post
10-30-20, 04:30 PM   #5
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,325
From what I see, you're defining the function as AMine:getListFromDB() and calling as self.getListFromDB().

In this case, the first argument gets passed into the implicit variable self and DB gets the second argument, which is unspecified (automatically nil).
If you called with the colon notation, self gets passed in as the implicit variable and button will get assigned to DB.


For example, these function definitions are the same ...
Code:
function table:func(arg)
function table.func(self,arg)
... and these calls are the same.
Code:
table:func(arg)
table.func(table,arg)
You need to compensate for the argument shifting if you plan on using differing notations between definition and calling.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 10-30-20 at 04:32 PM.
  Reply With Quote