WoW:API UnitBuff: Difference between revisions

mNo edit summary
Line 23: Line 23:


== Example ==
== Example ==
  local x, i = "You're currently buffed with the following buffs: ", 1;
  local buffs, i = { }, 1;
  while (UnitBuff("player",i) ~= nil) do
  local buff = UnitBuff("player", i);
  x = x .. UnitBuff("player",i) .. ", ";
while buff do
  i = i + 1;
  buffs[#buffs + 1] = buff;
  end
  i = i + 1;
  if (i == 1) then
  buff = UnitBuff("player", i);
  x = x .. "no buffs.";
  end;
  if #buffs < 1 then
  buffs = "You have no buffs";
  else
  else
  x = strsub(x,0,-3) .. ".";
  buffs[1] = "You're buffed with: "..buffs[1];
  end
  buffs = table.concat(buffs, ", ");
  DEFAULT_CHAT_FRAME:AddMessage(x);
  end;
 
  DEFAULT_CHAT_FRAME:AddMessage(buffs);


=====Macro Option:=====
=====Macro Option:=====
Anonymous user