Also notable:
New table searching functions were added
https://github.com/esoui/esoui/blob/...tableutils.lua
Lua Code:
-- Creates a non-contiguous table, the keys of which are the unique values
-- in the numerically indexed table t or, if t is scalar, the value of t.
function ZO_CreateSet(t)
local s = {}
local tType = type(t)
if tType == "table" then
for _, v in ipairs(t) do
s[v] = true
end
elseif tType ~= "nil" then
s[t] = true
end
return s
end
-- Returns a non-contiguous table, the keys of which are the intersecting keys
-- shared between the non-contiguous sets s1 and s2.
function ZO_IntersectSets(s1, s2)
local s = {}
for k in pairs(s1) do
if s2[k] then
s[k] = true
end
end
return s
end
-- Returns true if the non-contiguous sets s1 and s2 share one or more keys.
function ZO_AreIntersectingSets(s1, s2)
return next(ZO_IntersectSets(s1, s2)) ~= nil
end
-- Returns a non-contiguous table, the keys of which are the intersecting values
-- shared between the numerically indexed tables t1 and t2.
function ZO_IntersectNumericallyIndexedTables(t1, t2)
local s1 = ZO_CreateSet(t1)
local s2 = ZO_CreateSet(t2)
return ZO_IntersectSets(s1, s2)
end
-- Returns true if the numerically indexed tables t1 and t2 share one or more values.
function ZO_AreIntersectingNumericallyIndexedTables(t1, t2)
local s = ZO_IntersectNumericallyIndexedTables(t1, t2)
return next(s) ~= nil
end
-- Returns true if the non-contiguous sets s1 and s2 contain the same keys.
function ZO_AreEqualSets(s1, s2)
local size1 = NonContiguousCount(s1)
local size2 = NonContiguousCount(s2)
if size1 ~= size2 then
return false
end
for k in pairs(s1) do
if not s2[k] then
return false
end
end
return true
end
Used in the new universal deconstruction filter function e.g. to compare the filterType's itemFilter (enchantments) or itemTypeFilters (armor, weapon, jewelry) with the itemType/itemFilterType of an inventory item.
Lua Code:
function ZO_UniversalDeconstructionPanel_Shared.DoesItemPassFilter(bagId, slotIndex, filterType)
local itemFilterTypes = {GetItemFilterTypeInfo(bagId, slotIndex)}
if ZO_IsElementInNumericallyIndexedTable(itemFilterTypes, ITEMFILTERTYPE_JEWELRY) and not ZO_IsJewelryCraftingEnabled() then
return false
end
if filterType then
if filterType.itemTypes then
local itemType = GetItemType(bagId, slotIndex)
if not ZO_AreIntersectingNumericallyIndexedTables(filterType.itemTypes, itemType) then
return false
end
end
if filterType.itemFilterTypes then
if not ZO_AreIntersectingNumericallyIndexedTables(filterType.itemFilterTypes, itemFilterTypes) then
return false
end
end
end
return true
end