Thread Tools Display Modes
04-21-15, 07:51 PM   #1
Yafis
A Fallenroot Satyr
 
Yafis's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 29
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> {
 }
}

Last edited by Yafis : 04-21-15 at 07:53 PM.
  Reply With Quote
04-21-15, 08:36 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
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)
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
04-22-15, 03:02 AM   #3
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
:IsForbidden()
__________________
Grab your sword and fight the Horde!
  Reply With Quote
04-22-15, 03:31 AM   #4
Yafis
A Fallenroot Satyr
 
Yafis's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 29
Originally Posted by Seerah View Post
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

Last edited by Yafis : 04-22-15 at 04:35 AM.
  Reply With Quote
04-22-15, 01:30 PM   #5
Tim
A Rage Talon Dragon Guard
 
Tim's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 309
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
__________________
AddOns: Tim @ WoWInterface
Battle Tag: Mysterio#11164
Current PC Setup: PCPartPicker List
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » GetName Error


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off