View Single Post
11-15-16, 09:17 AM   #20
_Max_Cavalera_
A Fallenroot Satyr
 
_Max_Cavalera_'s Avatar
Join Date: Dec 2007
Posts: 28
ok, i've been reading the code you put up (thanks once again for that), i'm implementing it right now, have a few questions though since I'm doing this to learn, implementing without knowing why or what something does isn't really an option xD

I'll start at the end since people always like to start at the beginning

Lua Code:
  1. MainFrame:SetShown(itemid and true or false);

Can you explain this line to me? I think that it's supposed to be, show frame if itemID exists?! but I don't get how the and true or false works.

Backgrounds... do I really need them? I know I had one, I made it because I was learning from a book and it listed the background as something to use when making a frame but as you know mine wasn't even working and i didn't even notice it because it was already supposed to be almost invisible at 0.2 alpha.
It works without one so I guess there's no problem in not having one? Or can it create problems?

Can you explain why %5$d and %6$d is needed to grab the 5th and 6th parameter when the position of those in the string are the 5th and 6th? Shouldn't they already pick up the right ones with just %d? Or is it \n that breaks that?
By the way, I didn't know I could do that so, thanks

EDIT:. ok I understand this one now I think, it's because of the (available>0 and " (+%d)" or ""), they MIGHT or MIGHT NOT be the 5th and 6th... damn I'm dumb...

And finally,

Lua Code:
  1. (available>0 and " (+%d)" or "")

You have this on the formatted text, I guess it's supposed to be if available > 0 do the first one else do the other one?!?! So it's like an IF statement to use inside strings?

How does it work? From what you have I think it's (if condition and then or else) but the fact that the if condition is followed by and seems so strange to me xD

Last edited by _Max_Cavalera_ : 11-15-16 at 10:16 AM.
  Reply With Quote