Here's some examples (traditional format for clarity... edit for in-game usage):
Code:
local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, shouldConsolidate, spellId
if UnitBuff("player","Mind Melt") and count==2 then
CastSpellByName("Mind Blast")
end
If you aren't going to utilize all returns within a function (if you needed to save space in a macro, for example) you can use something like local name,_,_,count,_,_,_,UnitCaster, and so on.
Or, a more simplistic/tidy method:
Code:
local mm={UnitBuff("player","Mind Melt")}
if UnitBuff("player","Mind Melt") and mm[4]==2 then
CastSpellByName("Mind Blast")
end
Where [4] is the fourth result from the UnitBuff function (which happens to be count). And you can add other things like mm[7]-GetTime()<=2 (where [7] refers to expirationTime) to use Mind Blast with less than or equal to 2 seconds left of the Mind Melt buff, which is probably not even a good idea to do in this case, but I'm just giving another example.
Good luck.