Thread Tools Display Modes
09-02-24, 07:10 AM   #1
rnxm
A Kobold Labourer
Join Date: Sep 2024
Posts: 1
Extracting code from addon and repurposing+consolidating

Hello! New to the forum and new to LUA/coding in general

i'm curious about some interactability code used by SUF

local secureInitializeUnit = [[
local header = self:GetParent()

self:SetHeight(header:GetAttribute("style-height"))
self:SetWidth(header:GetAttribute("style-width"))
self:SetScale(header:GetAttribute("style-scale"))

self:SetAttribute("toggleForVehicle", true)

self:SetAttribute("*type1", "target")
self:SetAttribute("*type2", "togglemenu")
self:SetAttribute("type2", "togglemenu")

self:SetAttribute("isHeaderDriven", true)

-- initialize frame
header:CallMethod("initialConfigFunction", self:GetName())

what i'm looking for and wondering, is if a Weakaura can be the destination of a context menu through right click, and how to extract this code and consolidate it into its own small addon

Essentially an interactable WeakAura(which i know is not a good idea because of taint) but i'm not quite sure how SUF bypasses interaction in combat if its a protected frame?
  Reply With Quote
09-02-24, 08:36 AM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,355
Blizzard provides a few templates that are an exception to the rule of "addons can't run protected actions". A specific one to note of is SecureUnitButtonTemplate. This provides a framework to set up a custom UnitFrame. Configuration is provided through setting specific attributes. See SecureActionButtonTemplate for more details as they share most of their functionality.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Extracting code from addon and repurposing+consolidating


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off