"self" is implied as the first argument if the function is defined like so:
Code:
function MyTable:PrintNameAndNumber(num)
print(self.name, num)
end
Notice the colon (":").
It's also implied when used in the XML like this:
Code:
<OnEnter>
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:AddLine(self.date, 1, 1, 1);
GameTooltip:Show();
</OnEnter>
However, in a case like the below, self isn't implied so you'd have to put it in yourself:
Code:
MyFrame:RegisterEvent("ZONE_CHANGED_NEW_AREA")
MyFrame:SetScript("OnEvent", function(self)
print(self.name)
end)
See:
http://lua-users.org/wiki/ObjectOrientationTutorial