i've come up with this solution
Lua Code:
-- Search a table for a specific entry
-- see [url]https://stackoverflow.com/questions/33510736/check-if-array-contains-specific-value[/url]
function ns.contains(table, val)
for i=1, #table do
if table[i] == val then
return true
end
end
return false
end
-- Seach a table for a specific entry and return it's indes number
-- see [url]https://scriptinghelpers.org/questions/10051/is-there-a-way-to-remove-a-value-from-a-table-without-knowing-its-index[/url]
-- under Linear Search
function ns.tablefind(tab,el)
for index, value in pairs(tab) do
if value == el then
return index
end
end
end
-- Determine if any partymember is in Combat
local inCombat = {}
function ns.checkPartyCombat()
for name in pairs(ns.data.current) do
if UnitAffectingCombat(name) then
if not ns.contains(inCombat, name) then
tinsert(inCombat, name)
end
else
if ns.contains(inCombat, name) then
tremove(inCombat, ns.tablefind(inCombat, name))
end
end
end
if table.getn(inCombat) > 0 then
return true
else
return false
end
end
where ns.data.current is a table that is filled per COMBAT_LOG_EVENT_UNFILTERED and emptied on PLAYER_REGEN_ENABLED
in this case we can now check ns.checkPartyCombat() which returns either true or false.
for reference here's the whole thing
core.lua