-
Notifications
You must be signed in to change notification settings - Fork 39
Public API
Bernhard Saumweber edited this page Sep 28, 2024
·
1 revision
-
PremadeGroupsFilter.Macro(expression, sorting)
- string
expression
is your custom filtering expression - optional string
sorting
is your custom sorting expression
- string
Macro example 1:
/run PremadeGroupsFilter.Macro("mprating >= 1000 and not declined")
Macro example 2 with sorting:
/run PremadeGroupsFilter.Macro("tanks + heals > 0", "age asc")
-
PremadeGroupsFilter.OverwriteSortSearchResults(addonName, customSortingFunction)
- string
addonName
is the name of your addon - function
customSortingFunction
is a function that takes theresults
table (containing a list of search result IDs) and sorts it in place
- string
-
PremadeGroupsFilter.RestoreSortSearchResults(addonName)
- string
addonName
is the name of your addon
- string
local addonName, addon = ...
local customSortingFunction = function(results)
table.sort(results, function(resultID1, resultID2)
local info1 = C_LFGList.GetSearchResultInfo(resultID1)
local info2 = C_LFGList.GetSearchResultInfo(resultID2)
return info1.age > info2.age -- by age oldest to newest
end)
end
local frame = CreateFrame("Frame", addonName .. "EventFrame")
frame:RegisterEvent("ADDON_LOADED")
frame:SetScript("OnEvent", function(self, event, ...)
if event == "ADDON_LOADED" and select(1, ...) == addonName then
print("Overwriting sorting function of PremadeGroupsFilter")
PremadeGroupsFilter.OverwriteSortSearchResults(addonName, customSortingFunction)
--PremadeGroupsFilter.RestoreSortSearchResults(addonName)
end
end)
PremadeGroupsFilter.EnableDebugLogging()
Type into chat window:
/run PremadeGroupsFilter.EnableDebugLogging()