aura_env.button = CreateFrame(“Button”, “SendMission”, WeakAuras.regions[aura_env.id].region, “SecureActionButtonTemplate”)
Create a button named “SendMission” (not a great name) that is parented to the WeakAuras.regions[aura_env.id].region frame and inherits the “SecureActionButtonTemplate” (the template does not contain anything that is visible on-screen so you would need to add textures/texts etc.)
aura_env.button:SetAllPoints(WeakAuras.regions[aura_env.id].region)
Make it the same size/shape and location as the WeakAuras.regions[aura_env.id].region frame.
aura_env.button:Show()
Show the frame (not really needed as all frames are shown by default (and the frame doesn’t contain anything visible so…))
aura_env.button:SetAttribute(“type”, “macro”)
Make it a macro type action button designed to run macros instead of say casting a spell.
aura_env.button:SetAttribute(“macro”, “/run C_Garrison.StartMission(missionID):onclick” )
The macro to run when the button is clicked.
If you changed the first aura_env.button to local f and the others to just f you could reference the button without WeakAuras.
If you changed WeakAuras.regions[aura_env.id].region to UIParent you also wouldn’t need WA.
If you changed SetAllPoints(WeakAuras.regions[aura_env.id].region) to SetPoint("CENTER") the button would appear in the center of your screen.
If you made “SecureActionButtonTemplate” into “SecureActionButtonTemplate, ActionButtonTemplate” you would have a button that looked like as normal empty action button that you could add an icon to etc.
The code becomes something like (for a standalone secure action button, no WA required):
local f = CreateFrame("Button", "RuanxSendMission", UIParent, "SecureActionButtonTemplate, ActionButtonTemplate")
f:SetPoint("CENTER")
f:SetSize(32, 32)
f.icon:SetTexture("Interface\\PetBattles\\MountJournalEmptyIcon"); -- random icon to just see the button
f:SetAttribute("type", "macro")
f:SetAttribute("macro", "/run C_Garrison.StartMission(missionID):onclick" )
You could copy/paste the above to the website addon.bool.no to create/download a small addon to play with (clicking the button won’t do anything bacause at least it would need the garrison UI open and a vaild missionID supplied but you can change the macro text to any valid macro and try it.
You can change the location of the button on-screen by changing the SetPoint(…)
The code you posted is presumably from someone using WA to create a button (also presumably with an icon etc.) then using it’s OnLoad code (or whatever WA calls it) to create the secure macro button and position it transparently over the WA button.