Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Custom Lua Functions for Touchy's Pitbull Unit Frames Config

By: a guest on Oct 11th, 2011  |  syntax: Lua  |  size: 0.81 KB  |  views: 3,406  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Absolute health:
  2.  
  3. local s = Status(unit)
  4. if s then
  5.   return " "
  6. elseif HP(unit) == MaxHP(unit) then
  7.   return "%s", Short(MaxHP(unit), true)
  8. else
  9.   return "%s / %s",Short(HP(unit),true),Short(MaxHP(unit),true)
  10. end
  11.  
  12.  
  13.  
  14. Name:
  15.  
  16. local abbr = Name(unit)
  17. if abbr:len() > 20 and abbr:find(" ") then
  18.   abbr = abbr:gsub("([^ ]+) +",
  19.     function(text)
  20.         return text:sub(1,1) .. ". "
  21.     end)
  22. end
  23. return "%s", abbr;
  24.  
  25.  
  26.  
  27. Health (Percentage):
  28.  
  29. local s = Status(unit)
  30. if s then
  31.   return s
  32. elseif HP(unit) == MaxHP(unit) then
  33.   return " "
  34. else
  35.   return "%s%%",Percent(HP(unit),MaxHP(unit))
  36. end
  37.  
  38.  
  39.  
  40. Power:
  41.  
  42. local max = MaxPower(unit)
  43. if max > 0 then
  44.   if Power(unit) == max then
  45.     return "%s", Short(Power(unit),true)
  46.   else
  47.     return "%s / %s",Short(Power(unit),true),Short(max,true)
  48.   end
  49. end
  50.