-
Posted by noob_coder on Thu, 15 Apr 2010 14:43:29
I have 2 questions about arrays and if statements that do not relate to each other.
Question 1: How do I properly structure if statements in Addon Studio? I have the following code:
function blah()
if a == 0 then
do something
elseif a != 0 then
do something else
end
end
That nifty little vertical line on the far left that shows where function blah() starts and where it ends is whats messing up. Without the if statement this vertical line will go from function blah() to the last end wich is where the function is closed. When I enter the if statement the vertical line will only extend from the function blah() to the if statements end being the second from the bottom end. I have tried with and without closing out the if statement within the function and it doesnt work either way. Am I doing something wrong with my if statements structure?
Question 2: I am trying to make an addon that will allow me to enter a name into a text box and save that name to an array variable and save that variable for when WoW is reloaded. I have a good idea of how it would have to be made but I can not find anywhere on how to save array variables for later use.
-
Posted by jnwhiteh on Thu, 15 Apr 2010 19:42:07
I have 2 questions about arrays and if statements that do not relate to each other.
Question 1: How do I properly structure if statements in Addon Studio? I have the following code:
What you posted was correct.
if condition then -- do something else -- do something else end
If things aren't showing up in Addon Studio, you should contact them for support.
Question 2: I am trying to make an addon that will allow me to enter a name into a text box and save that name to an array variable and save that variable for when WoW is reloaded. I have a good idea of how it would have to be made but I can not find anywhere on how to save array variables for later use.
There's a section of the book on SavedVariables and how to use them, depending on which version of the book you have. Any global variables declared in the table of contents file will be stored and loaded.