From 8e33540fad10b10dbf1ef94feebf19d9c6801021 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Wed, 31 Jul 2024 18:19:19 +0200 Subject: [PATCH] core: Add support for passing header attributes as a table --- ouf.lua | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/ouf.lua b/ouf.lua index 879165c8..0732d63b 100644 --- a/ouf.lua +++ b/ouf.lua @@ -621,7 +621,7 @@ do (string?) * visibility - macro conditional(s) which define when to display the header (string). * ... - further argument pairs. Consult [Group Headers](https://warcraft.wiki.gg/wiki/SecureGroupHeaderTemplate) - for possible values. + for possible values. If preferred, the attributes can be an associative table. In addition to the standard group headers, oUF implements some of its own attributes. These can be supplied by the layout, but are optional. PingableUnitFrameTemplate is inherited for Ping support. @@ -640,10 +640,19 @@ do local header = CreateFrame('Frame', name, PetBattleFrameHider, template) header:SetAttribute('template', 'SecureUnitButtonTemplate, SecureHandlerStateTemplate, SecureHandlerEnterLeaveTemplate, PingableUnitFrameTemplate') - for i = 1, select('#', ...), 2 do - local att, val = select(i, ...) - if(not att) then break end - header:SetAttribute(att, val) + + if(...) then + if(type((...)) == 'table') then + for att, val in next, (...) do + header:SetAttribute(att, val) + end + else + for i = 1, select('#', ...), 2 do + local att, val = select(i, ...) + if(not att) then break end + header:SetAttribute(att, val) + end + end end header.style = style