Thread Tools Display Modes
01/29/23, 03:25 PM   #1
notnear
 
notnear's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2022
Posts: 4
Advanced Filters Plugin

I'm trying to make a plugin that adds a "Trial sets" entry, based on Advanced Filters - Monster sets filter plugin.

Got it to work just changing the instances of "monster" to "trial" but if I have both plugins active It'll give an error related to duplicate addon plugin.

I get the following error that changes depending on which plugin was loaded first I believe, and the filters for one of them (in this case Trial sets) show up and work normally. Sorry if it's an obvious fix and thanks in advance!

Lua Code:
  1. user:/AddOns/AdvancedFilters/files/API.lua:132: attempt to index a function value
  2. stack traceback:
  3. user:/AddOns/AdvancedFilters/files/API.lua:132: in function 'AdvancedFilters_RemoveDuplicateAddonPlugin'
  4. <Locals> filterInformation = [table:1]{filterType = 2}, groupName = "Armor", filterTypeWasMappedToNewFilterTypeCategory = T, addonInformation = [table:2]{}, removedDuplicate = F, subfilterCallBacksOfGroup = [table:3]{}, existingAFSubfilterCallbacksInfo = [table:4]{}, index = 6, subfilterCallbacksInfo = [table:5]{}, newPluginCallbackTable = [table:6]{name = "FCOMonsterSetsAll"}, existingSubfilterCallbacksTableAtGroup = [table:7]{name = "TrialSetsAll"}, cbTabIndex = "filterCallback", cbTabEntry = user:/AddOns/AF_TrialSetFilters/AF_TrialSetFilters.lua:108 </Locals>
  5. user:/AddOns/AdvancedFilters/files/API.lua:196: in function 'parseFilterInformation'
  6. <Locals> filterInformation = [table:1], addonInformation = [table:8]{}, itemFilterCategory = 2, groupName = "Armor" </Locals>
  7. user:/AddOns/AdvancedFilters/files/API.lua:235: in function 'AdvancedFilters_RegisterFilter'
  8. <Locals> filterInformationTable = [table:1], parseFilterInformation = user:/AddOns/AdvancedFilters/files/API.lua:174, filterTypes = 2 </Locals>
  9. user:/AddOns/AF_FCOMonsterSetFilters/AF_FCOMonsterSetFilters.lua:381: in function 'addOnPluginLoaded'
  10. <Locals> event = 65536, name = "AF_FCOMonsterSetFilters", monsterSetIds = [table:9]{}, setNamesWithId = [table:10]{Zaan = 350, Sentinel of Rkugamz = 268, Shadowrend = 265, Ilambris = 273, Pirate Skeleton = 277, Grundwulf = 458, Earthgore = 341, Immolator Charr = 599, Lord Warden = 164, Vykosa = 398, Maarselok = 459, Infernal Guardian = 272, Magma Incarnate = 609, Slimecraw = 270, Symphony of Blades = 436, Nazaray = 633, Velidreth = 257, Valkyn Skoria = 169, Lady Malygda = 635, Kargaeda = 632, Sellistrix = 271, Archdruid Devyric = 666, Baron Zaudrus = 578, Stone Husk = 534, Lady Thorn = 535, Encratis's Behemoth = 577, Glorgoloch the Destroyer = 600, Zoal the Ever-Wakeful = 598, Maw of the Infernal = 170, Stonekeeper = 432, Molag Kena = 183, Swarm Mother = 267, Balorgh = 397, The Troll King = 278, Grothdarr = 280, Stormfist = 275, Nerien'eth = 168, Iceheart = 274, Tremorscale = 276, Euphotic Gatekeeper = 667, Baron Thirsk = 636, Engine Guardian = 166, Thurvokun = 349, --ALL_MONSTER_SETS-- = 9999999999, Mighty Chudan = 256, Scourge Harvester = 165, Selene = 279, Chokethorn = 269, Mother Ciannait = 478, Kjalnar's Nightmare = 479}, setNamesSorted = [table:11]{1 = "--ALL_MONSTER_SETS--::99999999..."}, GetFilterCallbackForSets = user:/AddOns/AF_FCOMonsterSetFilters/AF_FCOMonsterSetFilters.lua:107, allMonsterSetsDropdownCallback = [table:6], fullDropdownSetsCallbacks = [table:12]{}, dropdownFiveSetEachCallbacks = [table:13]{}, dropdownFiveSetEachKeys = [table:14]{1 = "A-E"}, dropdownFiveSetEachCharactersKey = [table:15]{}, foundSetsCharacters = [table:16]{1 = 97}, buildFullLevelDropdownSetCallbacks = user:/AddOns/AF_FCOMonsterSetFilters/AF_FCOMonsterSetFilt
  Reply With Quote
01/29/23, 04:21 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
The error says it tries to index a function value so somehow a table is expected but it got a function instead.
The error also says its at your new addon file at line 108 where something was defined as index, which is filterCallback (does not sound like an index :-) more like a function )

existingSubfilterCallbacksTableAtGroup = [table:7]{name = "TrialSetsAll"},
...
user:/AddOns/AF_TrialSetFilters/AF_TrialSetFilters.lua:108

Check your new plugin addons code if you have accidently added a wrong , or changed a parameter of the addonInformation table, or the callback findings table, which you register as new filter to AF.
Did you miss to change a table key to your new names and it still says "MonsterSets" or similar maybe?

If you cannot find anything please post you complete zip file containing the txt and lua files of your plugin here so I can have a look and test with my AF_FCOMonsterSets plugin myself. Maybe there is a bug in the AF plugin duplicates check that needs to be fixed in AF base code.

Last edited by Baertram : 01/29/23 at 04:31 PM.
  Reply With Quote
01/29/23, 05:05 PM   #3
notnear
 
notnear's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2022
Posts: 4
I compared the files and everything seems good, only differences are where I replaced "Monster" with "Trial", zip with the folder is attached.
Attached Files
File Type: zip AF_TrialSetFilters.zip (5.6 KB, 97 views)
  Reply With Quote
01/29/23, 06:58 PM   #4
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 626
I have never done this before but I do use itemID numbers in MM so I'm curious. Did you account for the fact that if you're copying somebody else's mod that uses monster sets have you looked at enough of the mod so that you're actually telling the game what the trial set is?

Just changing Monster to Trial as far as text goes will for sure change the text, but how are you telling the game all of the different ID numbers for all of the different trial sets so that the filter works correctly.

Now on the other hand it is a constant for a filter type and not an ID number, ignore what I just said.

Other than you may want to double check that you're actually telling the filter that it's trial set and not a monster set cause I have a feeling you have to define that somehow.

Last edited by Sharlikran : 01/29/23 at 07:00 PM.
  Reply With Quote
01/29/23, 07:10 PM   #5
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
@Sharlikran this is handled by LibSets, you need to exchange the used API functions so that it returns the other set types.
But if this was forgotten it should not raise the error shown. Not sure what it is, I'll have a look at the files attached once I find the time.

For me it reads, from the error, as if something is not properly indexed in a table and at the index it reads it finds a function and not the table it expects. So either the param order passed to the API function or most likely the param order inside the table passed to the API function is not correct. Or there is a general bug in the AF filter plugin "duplicate check" code.
  Reply With Quote
01/30/23, 06:19 AM   #6
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
On first compare I couldn't find any errors in the code.
Will have to use both addons and add debug messages etc. to find out what is happening here

Easiest fix would be to add a table check at the API function. The error happens because at this code
Lua Code:
  1. for cbTabIndex, cbTabEntry in pairs(existingSubfilterCallbacksTableAtGroup) do
  2.                         if cbTabEntry ~= nil and cbTabEntry.name ~= nil and cbTabEntry.name == newPluginCallbackTable.name then

cbTabIndex = "filterCallback" String
cbTabEntry = function pointing to AF_TrialSetFilters.lua:108
Code:
107   local function GetFilterCallbackForSets( setId )
108		return function( slot , slotIndex)
-> And cbTabEntry is expected to be a table with a .name entry
cbTabEntry should be "allTrialSetsDropdownCallback":
Lua Code:
  1. local allTrialSetsDropdownCallback = { name = subMenuEntryAllSets, filterCallback = GetFilterCallbackForSets( allSetsConstantId ) }
There it would find ".name".
But it somehow got to the inner table parts of allTrialSetsDropdownCallback instead, as it was passed to "callbackTable" of the filterInformation.
So somehow, if 2 addons with the same subfilterGroup plugins are active, the scanned table "depth" gets wrong.

Last edited by Baertram : 01/30/23 at 06:40 AM.
  Reply With Quote
01/30/23, 09:05 AM   #7
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Found the problem:
The entry I had marked in my last post
Code:
local allTrialSetsDropdownCallback = { name = subMenuEntryAllSets, filterCallback = GetFilterCallbackForSets( allSetsConstantId ) }
is missing the correct "subTable" so that the indices are correct:

Lua Code:
  1. local allTrialSetsDropdownCallback = { { name = subMenuEntryAllSets, filterCallback = GetFilterCallbackForSets( allSetsConstantId ) } }

This was wrong in my filter plguin already but did not raise any error/worked as intended.
  Reply With Quote
01/30/23, 10:34 AM   #8
notnear
 
notnear's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2022
Posts: 4
Thank you for your help Baertram!
Can I post the corrected version of Trial sets or would you prefer posting since all I did was replace the words? I removed the "FCO" since from what I undestrood it's your guilds name or something similar, wasn't sure if it was ok to keep it.

PS, on your update to the plugin you didn't change the version on the manifest, so it's not auto updating on minion.


Edit: the addon is now giving this chat error "ERROR - Translating missing for dropdown filter entry: FCOMonsterSetsAll" and "ERROR - Translating missing for dropdown filter entry: TrialSetsAll", tested and it shows up even if only the addon and one of the plugins is active.

Tested changing between languages using "/script SetCVar("language.2", "xx")" and the strings seem to be working fine.
I found that it is checked at files\FilterBar\FilterBar.lua line 787 but dan't wrap my mind around how this works to try and find why we're getting this error.

Last edited by notnear : 01/30/23 at 11:16 AM.
  Reply With Quote
01/30/23, 12:27 PM   #9
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Would have been to easy if all had worked just fine...
I think the error did not show for me as I had added some new lines locally within AF API.lua. Unsure why it shows at all though as the translations are there

Edit:
I guess I missed the [ ] around the table index constant subMenuEntryAllSets here:
Lua Code:
  1. --First add 1 entry for "All monster sets"
  2.     local stringsAllEN = { subMenuEntryAllSets = transl.ALL_MONSTER_SETS_SUBMENU_ENTRY }
  3.     local stringsAllDE = { subMenuEntryAllSets = transl.ALL_MONSTER_SETS_SUBMENU_ENTRY }
  4.     local stringsAllFR = { subMenuEntryAllSets = transl.ALL_MONSTER_SETS_SUBMENU_ENTRY }

The tables stringsAllEN DE and FR are passed in as you register the new dropdown filter plugin. It contains a key, which should be the same as the entry that runs the filter callback (which is defined via
Code:
local allMonsterSetsDropdownCallback = { {name = subMenuEntryAllSets, filterCallback = GetFilterCallbackForSets( allSetsConstantId )} }
's "name" tag
)
and thus needs the "subMenuEntryAllSets" costant as table key within stringsAllEN, DE and FR.

Try if changing these lines (add the [ ]) helps removing the error:
Lua Code:
  1. --First add 1 entry for "All monster sets"
  2.     local stringsAllEN = { [subMenuEntryAllSets] = transl.ALL_MONSTER_SETS_SUBMENU_ENTRY }
  3.     local stringsAllDE = { [subMenuEntryAllSets] = transl.ALL_MONSTER_SETS_SUBMENU_ENTRY }
  4.     local stringsAllFR = { [subMenuEntryAllSets] = transl.ALL_MONSTER_SETS_SUBMENU_ENTRY }

Last edited by Baertram : 01/30/23 at 02:51 PM.
  Reply With Quote
01/30/23, 02:54 PM   #10
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,912
Oh about "releasing it":
Feel free to release it with your name, it was your idea.

I'd only be glad if you write the same you wrote here to the plugin's description then:
Code was taken 100% from Baertram's plugin and only "Trial" names were changed + the trial sets to read.
  Reply With Quote
01/30/23, 03:25 PM   #11
notnear
 
notnear's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2022
Posts: 4
Gave you a bit of trouble with this hahah I added the brackets and the error is not showing up anymore

Thanks again for all the help and absolutely will!
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Advanced Filters Plugin

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