1. Should be:

    function TargetText:UpdateClass ()

        local class, key = UnitClass ("target")

        local color = RAID_CLASS_COLORS [key]

        TargetTextFrameClass:SetText (key)

        TargetTextFrameClass:SetTextColor (color.r, color.g, color.b)   

    end

    Can't get UpdatepowerType to set color correctly.

    Should be:

    function TargetText:UpdateClass ()

        local class, key = UnitClass ("target")

        local color = RAID_CLASS_COLORS [key]

        TargetTextFrameClass:SetText (key)

        TargetTextFrameClass:SetTextColor (color.r, color.g, color.b)   

    end

    Can't get UpdatepowerType to set color correctly.

    XSSFilter could not parse (X)HTML:
    
    
    
    <blockquote>
    <p>Should be:</p>
    <blockquote>
    <p>function TargetText:UpdateClass ()<br />    local class, key = UnitClass ("target")<br />    local color = RAID_CLASS_COLORS [key]<br />    TargetTextFrameClass:SetText (key)<br />    TargetTextFrameClass:SetTextColor (color.r, color.g, color.b)    <br />end</p>
    </blockquote>
    
    
    <p>Can't get UpdatepowerType to set color correctly.</p>
    
    <p></blockquote></p>
    
    <p>No, this is not correct.  The code listed on page 198 is absolutely correct.  What you've done here is change it to use the upper-case english name of the class rather than the actual localized class name.  Also, I don't understand what you mean regarding <code>UpdatePowerType()</code>.  You can download the code for the addon from the website (<a href="http://wowprogramming.com/chapters/15">http://wowprogramming.com/chapters/15</a>) to check it against yours but the addon code listed in that chapter is correct to the best of our knowledge.</p>
    
    

    OK - got confused by the fact that sometimes it returns the name of a character rather than a class - but the WOW interface does the same.

    In a recent patch (2.4, I believe) Blizzard changed the functionality of UnitClass and UnitRace (possibly others?) to return the names of NPCs instead of their actual class or race. To get the intended functionality, you should use UnitClassBase and UnitRaceBase.

    I'll add this to the Errata for the chapter.