View Single Post
02-08-13, 07:37 PM   #4
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
You can't refer to ServerPanel before the variable is declared. So, add it only after you create your ServerPanel frame. Also, it doesn't matter in lua whether or not you add a semicolon at the end of your line.

What do you mean by 'the third code'? If you mean the third snipped I posted; that was just an example to show that you don't need to declare your function as a variable if you only use it once.

As for the last bit of code you posted; a colon is followed by a method call (which is followed by brackets). Show and Hide also are not used to check whether a frame is shown. To write it the way you have in mind, it'd have to be:

Code:
if ServerPanel:IsShown() then
	ServerPanel:Hide()
else
	ServerPanel:Show()
end
However, it's simpler to use:

Code:
ServerPanel:SetShown(not ServerPanel:IsShown())
Like I posted before.
  Reply With Quote