View Single Post
11-18-15, 06:47 AM   #1
Darsyek
A Murloc Raider
Join Date: Nov 2015
Posts: 5
Need help with Stuf Unit Frames custom LUA

Hey there,

As the title suggests, I'm looking for some help with some custom LUA coding for Stuf Unit Frames. I'll try to be as specific as I can be while trying this at 5:45am.

What I'm trying to do is have my power bar display a percentage for any class that uses mana and a flat number for everything else (ie. energy, rage, runic power, focus, etc.)

I've spent a couple hours researching the UnitPower LUA stuff, but I just couldn't get it to work. Here's the code I have so far:

Code:
function(unit, cache, textframe)
if UnitPowerType("player") == 0 then
    local z = math.max(0, UnitPower("player")) / math.max(1, UnitPowerMax("player")) * 100;
    return string.format("%.f", z) .. "%%";
else return UnitPower("player") end
Any help would be greatly appreciated.
  Reply With Quote