Hide on Load Plus Minimap button actions.
I'm hoping I can get some help on this. I'm trying to get an addon running. (First time with LUA)
The first thing I have in my LUA is: Code:
function ServerPanel_OnLoad() Code:
function ServerCharacters_MinimapButton_OnClick() Code:
function ServerCharacters_MinimapButton_OnClick() |
1) You don't need to write a function for a frame to be hidden by default. Just use ServerPanel:Hide() after creation.
2) That would be: Code:
local function ServerCharacters_MinimapButton_OnClick() Code:
local _, myAddOnTable = ... Code:
myMinimapButton:SetScript("OnClick", function() |
I put
Code:
ServerPanel:Hide(); Code:
ServerPanel:Hide() Just a thought, but for the if else statement; Shouldn't there be something along the lines of Code:
function myfunction_OnClick() |
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 Code:
ServerPanel:SetShown(not ServerPanel:IsShown()) |
Quote:
|
All times are GMT -6. The time now is 03:38 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI