Question on GetTexture changes

I’m just getting around to working on an Classic world of warcraft addon that was abandoned. The addon in question is Wide Quest Log. The recent classic patch (a week or two old?) incorporated a lot of changes that happened to dragonflight, such as moving things to C_CurrencyInfo and C_Container namespaces along with some others. There was some sort of texture changes as well that I couldn’t track down. in particular, the [condensed] code is:

local regions = { QuestLogFrame:GetRegions() }

local PATTERN = "^Interface\\QuestFrame\\UI%-QuestLog%-(([A-Z][a-z]+)([A-Z][a-z]+))$";

for _, region in ipairs(regions) do
    if (region:IsObjectType("Texture")) then
        local texturefile = region:GetTexture();
        local which, yofs, xofs = texturefile:match(PATTERN);  -- line 107

The following error applies to the last line of that blurb

Message: Interface/AddOns/WideQuestLog/WideQuestLog.lua:107: attempt to index local 'texturefile' (a number value)
Time: Tue Jan 24 13:10:35 2023
Count: 1
Stack: Interface/AddOns/WideQuestLog/WideQuestLog.lua:107: attempt to index local 'texturefile' (a number value)
[string "@Interface/AddOns/WideQuestLog/WideQuestLog.lua"]:107: in main chunk

Locals: elvEnabled = false
ElvSkinFrames = <function> defined @Interface/AddOns/WideQuestLog/WideQuestLog.lua:6
oldQuestsDisplayed = 22
regions = <table> {
 1 = Texture {
 }
 2 = Texture {
 }
 3 = Texture {
 }
 4 = QuestLogTitleText {
 }
}
xOffsets = <table> {
 Right = 515
 Left = 3
 Middle = 259
}
yOffsets = <table> {
 Top = 0
 Bot = -256
}
textures = <table> {
 TopLeft = "Interface\AddOns\WideQuestLog\Icons\DW_TopLeft"
 TopMiddle = "Interface\AddOns\WideQuestLog\Icons\DW_TopMid"
 TopRight = "Interface\AddOns\WideQuestLog\Icons\DW_TopRight"
 BotLeft = "Interface\AddOns\WideQuestLog\Icons\DW_BotLeft"
 BotMiddle = "Interface\AddOns\WideQuestLog\Icons\DW_BotMid"
 BotRight = "Interface\AddOns\WideQuestLog\Icons\DW_BotRight"
}
PATTERN = "^Interface\QuestFrame\UI%-QuestLog%-(([A-Z][a-z]+)([A-Z][a-z]+))$"
(for generator) = <function> defined =[C]:-1
(for state) = <table> {
 1 = Texture {
 }
 2 = Texture {
 }
 3 = Texture {
 }
 4 = QuestLogTitleText {
 }
}
(for control) = 1
_ = 1
region = Texture {
 0 = <userdata>
}
texturefile = 136797
(*temporary) = Texture {
 0 = <userdata>
}
(*temporary) = 136797
(*temporary) = true
(*temporary) = "QuestLogTitle39"
(*temporary) = <function> defined =[C]:-1
(*temporary) = QuestLogTitle39Check {
 0 = <userdata>
}
(*temporary) = "LEFT"
(*temporary) = "QuestLogTitle39NormalText"
(*temporary) = "RIGHT"
(*temporary) = 2
(*temporary) = 0
(*temporary) = QuestLogTitle39NormalText {
 0 = <userdata>
}
(*temporary) = <userdata>
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index local 'texturefile' (a number value)"

It looks like something changed with the return value for GetTexture???

You’ll probably find that texturefile is a number as file paths are now turned into ids.

Ok thanks. Any recommendations on any writeups on how to use the ID to generate a file? I can poke around if not.

You could try (it might not work if the texture was set using an id):

There’s also this:
https://www.townlong-yak.com/framexml/10.0.2/Helix/ArtTextureID.lua

ok thanks! I’ll dig into that.

They added C_Texture.GetFilenameFromFileDataID in Dragonflight, but it’s hilariously useless.

C_Texture.GetFilenameFromFileDataID(1234567) returns “FileData ID 1234567” which is rather pointless.

The GetTextureFilePath would not return a file path if a texture given a file ID last I tried to use it. (But if you assigned a path to the texture then it will likely work; and GetTexture would too so this may not be your use case.)

Here’s hoping 10.0.5 today fixes one of those. To the best of my knowledge the only way of getting the filename of a file ID is to use one of those massive tables like the one Fizzlemizz linked.

yeah, hopefully they do fix one of those. Seems like a really odd change on their part

This is quite silly… and still not fixed. Any solutions or workarounds found by anyone?

@Jere @Huanezhen

This is the line producing the error (line 103):

            local which, yofs, xofs = texturefile:match(PATTERN);

To fix this go to the line above it (line 102):

change

            local texturefile = region:GetTexture();

to

            local texturefile = region:GetTextureFilePath();
1 Like