From 85975eaee1996cd796d18fa6a72161796e5830bf Mon Sep 17 00:00:00 2001 From: dein0s Date: Sat, 6 Apr 2019 14:48:13 +0300 Subject: [PATCH] addonbuttons: accept frame names as an argument --- modules/addonbuttons.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/addonbuttons.lua b/modules/addonbuttons.lua index 8e4c45c4..739694a5 100644 --- a/modules/addonbuttons.lua +++ b/modules/addonbuttons.lua @@ -310,10 +310,17 @@ pfUI:RegisterModule("addonbuttons", function () end end - local function ManualAddOrRemove(action) - local button = GetMouseFocus() + local function ManualAddOrRemove(msg) + local _, _, action, arg = string.find(msg, "%s?(%w+)%s?(.*)") - if action ~= "reset" and action ~= "add" and action ~= "del" then + local button + if arg and arg ~= "" then + button = getglobal(arg) + else + button = GetMouseFocus() + end + + if action == "" or (action ~= "reset" and action ~= "add" and action ~= "del") then DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccpf|rUI Addon Button Panel:") DEFAULT_CHAT_FRAME:AddMessage("|cff33ffcc/abp add|r - " .. T["Add button to the frame"]) DEFAULT_CHAT_FRAME:AddMessage("|cff33ffcc/abp del|r - " .. T["Remove button from the frame"])