WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   How to call functions on protected ui objects? (https://www.wowinterface.com/forums/showthread.php?t=58277)

Lybrial 10-14-20 09:07 AM

How to call functions on protected ui objects?
 
Im currently getting two errors:

Lua Code:
  1. AddOn 'Lybrial_ActionBars' tried to call the protected function 'SpellFlyout:SetFrameStrata()'.

And:

Lua Code:
  1. AddOn 'Lybrial_UI' tried to call the protected function 'Lybrial_ActionBars_Pet_Frame:Show()'.
  2. in function `FadeIn'

How can do either of those two things?

1. Call those functions anyway?
2. Prevent those functions from getting called when they are secured / protected?

For option two I thought checking for "IsForbidden()" would do the trick but I was wrong, meaning this here:

Lua Code:
  1. if (not _G.SpellFlyout:IsForbidden()) then
  2.     _G.SpellFlyout:SetFrameStrata("HIGH")
  3. end

And this:

Lua Code:
  1. if (not frame:IsForbidden()) then
  2.     UIFrameFadeIn(frame, 0.2, frame:GetAlpha(), 1);
  3. end

Did not fix the errors.

SDPhantom 10-14-20 10:04 AM

frame:IsForbidden()frame:IsProtected()

Forbidden frames means you can't interact with them at all. Protected frames just have limited access to a handful of functions while in combat. (see InCombatLockdown())

Lybrial 10-14-20 10:32 AM

Thank you, that solved it.


All times are GMT -6. The time now is 08:20 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI