Thread Tools Display Modes
11-13-22, 05:42 PM   #1
AkromaStrategy
A Defias Bandit
Join Date: Nov 2022
Posts: 2
Help with Lua Error

Hello,

There is this super cool addon called Glass that did a minimalistic chat ui.

side note: while typing this i noticed someone else has already put something up that i might use instead, but i'll ask my question anyways for fun.

while trying to fix it for dragonflight I got this error

Message: Interface/AddOns/Glass/Glass/Components/ChatTab.lua:48: attempt to index field '?' (a nil value)
Time: Sun Nov 13 15:21:02 2022
Count: 1
Stack: Interface/AddOns/Glass/Glass/Components/ChatTab.lua:48: attempt to index field '?' (a nil value)
[string "@Interface/AddOns/Glass/Glass/Components/ChatTab.lua"]:48: in function `Init'
[string "@Interface/AddOns/Glass/Glass/Components/ChatTab.lua"]:176: in function <Interface/AddOns/Glass/Glass/Components/ChatTab.lua:172>
[string "@Interface/AddOns/Glass/Glass/Modules/UIManager.lua"]:59: in function <Interface/AddOns/Glass/Glass/Modules/UIManager.lua:36>
[string "=[C]"]: ?
[string "@Interface/AddOns/Glass/libs/AceAddon-3.0/AceAddon-3.0.lua"]:70: in function <...face/AddOns/Glass/libs/AceAddon-3.0/AceAddon-3.0.lua:65>
[string "@Interface/AddOns/Glass/libs/AceAddon-3.0/AceAddon-3.0.lua"]:527: in function `EnableAddon'
[string "@Interface/AddOns/Glass/libs/AceAddon-3.0/AceAddon-3.0.lua"]:540: in function `EnableAddon'
[string "@Interface/AddOns/Glass/libs/AceAddon-3.0/AceAddon-3.0.lua"]:630: in function <...face/AddOns/Glass/libs/AceAddon-3.0/AceAddon-3.0.lua:615>

Locals: <none>
I write java/scala at my day job so i'm not an expert at lua, but i was wondering if anyone could tell why this is getting a null pointer exception? Line 48 that it references is the line below of _G[self:GetName()..texName..'Left']:SetTexture()

local tabTexs = {
'',
'Selected',
'Highlight'
}

local dropDown = _G[self.chatFrame:GetName().."TabDropDown"]

for _, texName in ipairs(tabTexs) do
_G[self:GetName()..texName..'Left']:SetTexture()
_G[self:GetName()..texName..'Middle']:SetTexture()
_G[self:GetName()..texName..'Right']:SetTexture()
end
  Reply With Quote
11-13-22, 07:01 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
https://www.curseforge.com/wow/addons/ls-glass
Same author I believe (but different name) but works with Dragonflight and other clients.

The error is most likely because the names of some elements have change for DF so while self.chatFrame:GetName() returns a name, there is probably no longer a frame with that name +"TabDropDown".

The _G[...] Is trying to lookup up the frame name in the global table. If it doesn't exist, that will return nil.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 11-13-22 at 07:08 PM.
  Reply With Quote
11-13-22, 09:48 PM   #3
AkromaStrategy
A Defias Bandit
Join Date: Nov 2022
Posts: 2
Yeah I saw ls-glass too. it's a different author than the orignal author of glass, this one did what i was thinking of first. so i'll probably just use his addon if he keeps updating it.

is there docs somewhere that list all the global frames that _G[...] has? I had some luck looking some up on wowpedia, but it's hard to navigate. I found some of the api calls that were removed here https://github.com/Ketho/BlizzardInt...af9983b916ebf3 but I'm not familiar with what files different api's are in. So tracking down all of them has been tough.
  Reply With Quote
11-13-22, 11:28 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
Every frame that has a name, whether created by the Blizzard UI or 3rd party addons, has that name added to the global table.

If you're looking for frames in the Blizz. UI you can extract all the UI code from the game use that to find the names.

https://wowpedia.fandom.com/wiki/Vie...interface_code

Using /fstack in-game and placing the mouse over a frame will also give you the name if the frame has one or was created as a key of another frame.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Help with Lua Error

Thread Tools
Display Modes

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