View Single Post
10-16-20, 09:41 AM   #2
Lybrial
A Flamescale Wyrmkin
AddOn Compiler - Click to view compilations
Join Date: Jan 2010
Posts: 120
Thank you for that update guide! It already helped alot!

So among other things you changed the method signature of UpdateColor to:

Lua Code:
  1. UpdateColor(self, event, unit, ....)

My Code for AdditionalPower before version 10 was:

Lua Code:
  1. function UNITS:AdditionalPower_UpdateColor(unit)
  2.     if (unit) then
  3.         local _, powerToken = UNITS:UnitPowerType(unit);
  4.  
  5.         if (powerToken == ADDITIONAL_POWER_BAR_NAME) then
  6.             self:Hide();
  7.         else
  8.             local color = Colors:GetColorForPower(ADDITIONAL_POWER_BAR_NAME);
  9.  
  10.             self:SetStatusBarColor(color.r, color.g, color.b, color.a);
  11.         end
  12.     end
  13. end

So now it is:

Lua Code:
  1. function UNITS:AdditionalPower_UpdateColor(_, unit)
  2.     if (unit) then
  3.         local _, powerToken = UNITS:UnitPowerType(unit);
  4.  
  5.         if (powerToken == ADDITIONAL_POWER_BAR_NAME) then
  6.             self:Hide();
  7.         else
  8.             local color = Colors:GetColorForPower(ADDITIONAL_POWER_BAR_NAME);
  9.  
  10.             self:SetStatusBarColor(color.r, color.g, color.b, color.a);
  11.         end
  12.     end
  13. end

But im getting:

Lua Code:
  1. 8x Lybrial_UI\units\elements\powerAdditional.lua:74: attempt to call method 'SetStatusBarColor' (a nil value)

So do I need to do something different?

Last edited by Lybrial : 10-16-20 at 10:52 AM.
  Reply With Quote