Originally Posted by Dridzt
I'm no longer playing, but have you tested it?
I'd been using it for quite a while with no issues, I don't think chatcode has changed significantly.
|
It's not really a matter of chatcode. It's a matter of how the function works. Calling a function as
owner:function() will pass owner as the hidden argument self, meaning any code within that function that refers to self will change the calling widget.
As an example, when you create a frame or button, it will inherit a lot of global functions which can be used to modify the widget, but these functions expect the widget to pass itself as the first argument. This is what the colon operator does in lua.
What you attempt to do in that snippet is call the function
Clear() that is attached to
SELECTED_CHAT_FRAME, without giving the function the actual frame that you intend to clear.
Example of difference between dot and colon operator:
Lua Code:
function SetID(self, value)
self.ID = value
end
owner.SetID = SetID -- attach function to widget
owner:SetID(1) -- passing itself as the hidden argument self
owner.SetID(self, 1) -- calling the function without hidden argument
owner.SetID(1) -- error, function will try to add nil value to an integer
owner.SetID(someOtherFrame, 1) -- uses the function SetID on owner to change someOtherFrame