WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   GetName Error (https://www.wowinterface.com/forums/showthread.php?t=52229)

Yafis 04-21-15 07:51 PM

GetName Error
 
Hi! How to do a background check so as not to give an error when using :GetName() in the Game Shop or Send Twitter
My Lua code:
Lua Code:
  1. local SFN = CreateFrame("Frame")
  2. SFN:SetScript("OnUpdate", function()
  3.     local f = GetMouseFocus()
  4.     if f then
  5.         local n = f:GetName() or tostring(f)
  6.         if n then
  7.             FramerateLabel:SetText(n.." - FPS: ")
  8.         end
  9.     end
  10. end)

Error:
Code:

Message: Interface\AddOns\WorldTools\Libs\lib_hook.lua:29: Attempt to access forbidden object from code tainted by an AddOn
Time: 04/22/15 04:48:51
Count: 182
Stack: [C]: in function `GetName'
Interface\AddOns\WorldTools\Libs\lib_hook.lua:29: in function <Interface\AddOns\WorldTools\Libs\lib_hook.lua:26>

Locals: (*temporary) = <unnamed> {
 SplashBanner = <unnamed> {
 }
 CurrentMarketPrice = <unnamed> {
 }
 NormalPrice = <unnamed> {
 }
 InvisibleMouseOverFrame = <unnamed> {
 }
 Strikethrough = <unnamed> {
 }
 GlowPulse = <unnamed> {
 }
 IconBorder = <unnamed> {
 }
 SplashBannerText = <unnamed> {
 }
 Icon = <unnamed> {
 }
 UpgradeArrow = <unnamed> {
 }
 Shadows = <unnamed> {
 }
 BuyButton = <unnamed> {
 }
 ProductName = <unnamed> {
 }
 Checkmark = <unnamed> {
 }
 Magnifier = <unnamed> {
 }
 Model = <unnamed> {
 }
 BannerFadeIn = <unnamed> {
 }
 0 = <userdata>
 Card = <unnamed> {
 }
 GlowSpin = <unnamed> {
 }
 Description = <unnamed> {
 }
 CurrentPrice = <unnamed> {
 }
 SalePrice = <unnamed> {
 }
}


Seerah 04-21-15 08:36 PM

o.O

Why are you doing that in an OnUpdate?

And you are aware that there is a slash command to see what frames are under your mouse, right? /framestack (or just /fstack)

Lombra 04-22-15 03:02 AM

:IsForbidden()

Yafis 04-22-15 03:31 AM

Quote:

Originally Posted by Seerah (Post 308353)
o.O

Why are you doing that in an OnUpdate?

And you are aware that there is a slash command to see what frames are under your mouse, right? /framestack (or just /fstack)

THANK you! I didn't know about this command :)

Tim 04-22-15 01:30 PM

Since you didn't know about fstack I'm assuming you also don't know about event tracing. You can track events using /eventtrace or /etrace


All times are GMT -6. The time now is 11:12 AM.

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