Thread: Stuf LUA help
View Single Post
10-03-15, 06:15 PM   #2
Nikita S. Doroshenko
A Cyclonian
 
Nikita S. Doroshenko's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2015
Posts: 45
Originally Posted by hikokun View Post
I'm looking for a custom lua code to show curhp/maxhp followed by perchp with two decimals for Stuf Unit Frames. The current code I'm using which only shows perchp with two decimals -

Code:
function(unit, cache, textframe)
  if UnitExists(unit) then
    local perchp = 100 * UnitHealth(unit)/UnitHealthMax(unit)
    return "%.2f%%",perchp
  else
    local perchp = 100 * UnitHealth("player")/UnitHealthMax("player")
    return "%.2f%%",perchp
  end
end
I'd like a code for both of the following setups if possible

300000/500000 | 60.00%
60.00% | 300000/500000


Thanks for any help!
Could you please paste a code that calls this function with this parameters (unit, cache, textframe).
Because we need to know what previous function do with our return.
Or you can show us whole .lua or .xml file, it will be more easy.

Solution will looks something like this:
Lua Code:
  1. local stamp = UnitHealth("player").." / "..UnitHealthMax("player").." | "..perchp
  2. return stamp
But then we need to change function that get our return value.
  Reply With Quote