View Single Post
02-26-13, 09:09 PM   #9
shalom69
A Fallenroot Satyr
Join Date: Feb 2013
Posts: 22
first of all F16Gaming thanks for the replies, I appreciate it

I actually had some code in there to check whether the WOW instance was the lead instance (had it print out a statement on the lead intance), when I removed it to post it here I also misclicked and removed an if-then statement at the top, that's why you saw an extra "end" in the code. I edited the code in the prior post to reflect the proper code...

the code works on my end.

That wasn't my issue, my question was a theoretical question why if-if structure wasn't working and a question about nesting a RegisterEvent within a if-then structure.

as for the first, see how my noob code is structured (ignoring the larger if-end instruction that frames the other statements because that isn't the issue)

function
if
elseif
elseif
elseif

I had the logic written as the following which did not work

function
if
if
if
if


it seems like if-if-if-if should work since they are all mutually exclusive instructions but it doesn't work. I was hoping someone could tell me why. Not just for this code but for when I try to map out the logic for other uses.

as for the later. I am wondering why I can't move my "if thisIsLeadWindow" outside the function. for example to

Code:
if thisIsLeadWindow then
    LeaderMessageHandlerFrame:RegisterEvent("CHAT_MSG_SAY")
end
or even

Code:
if thisIsLeadWindow then
   LeaderMessageHandlerFrame = CreateFrame("Frame")
end

To F16Gaming specifically, so you are telling me that I should indent 4 spaces when I go down one level in the code? Lol okay man I actually appreciate the pointers on the indents and things, because I am learning this on my own I don't know all the conventions and things. Which I actually do agree I should try to follow.

Finally, as I understand it, you are saying that variable = "nil" is a string and variable = nil is nil value. Right?

Last edited by shalom69 : 02-26-13 at 09:12 PM.
  Reply With Quote