View Single Post
03-17-19, 09:35 AM   #2
Terenna
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 105
You'll have to make a secure frame:

Lua Code:
  1. local secureFrame = CreateFrame('frame', nil, UIParent, 'SecureActionButtonTemplate')

then you'll need to hook your script as above. I think you'll need to set a reference frame for the MultiBarRight inside of the secure frame. So something like:

Lua Code:
  1. secureFrame:SetFrameRef('MultiBarRight', MultiBarRight)

Then you'll need to securely insert the reference frame into a secure table.

Lua Code:
  1. secureFrame:Execute([[
  2.      multiBarRightSecureTable = table.new()
  3.      mutliBarRightSecureTable[1] = secureFrame:GetFrameRef('MultiBarRight')
  4. ]])

Then you'll execute secure code in your MultiBarRight Hookscript:

Lua Code:
  1. MultiBarRight:HookScript('OnSizeChanged', function()
  2.      secureFrame:Execute([[
  3.           if multiBarRightSecureTable[1]:GetScale() > 0.81 then
  4.                multiBarRightSecureTable[1]:SetScale(0.8)
  5.           end
  6.      ]])
  7. end)

I think that will work. IDK, I just learned about secure coding yesterday and I'm probably not great at it. You might be able to skip the multiBarRightSecureTable thing altogether and just use self:GetFrameRef('MultiBarRight'):GetScale() and self:GetFrameRef('MultiBarRight'):SetScale(). I'm not sure, like I said I'm fairly new to this, too.
  Reply With Quote