View Single Post
Unread 01-05-13, 07:58 PM   #14
semlar
A Molten Giant
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 601
Alright, try this one, it should actually work this time.
Lua Code:
  1. local oSetAttribute = getmetatable(ActionButton1).__index.SetAttribute
  2. hooksecurefunc(getmetatable(ActionButton1).__index, 'SetAttribute', function(self, attribute)
  3.     if attribute ~= 'showgrid' then return end
  4.     oSetAttribute(self, 'showgrid', CursorHasSpell() or 0)
  5.     if not HasAction(self.action) then
  6.         self:Hide()
  7.     end
  8. end)

Plus I'm pretty sure my last example had an infinite loop in it, I'm surprised it worked at all.
semlar is online now   Reply With Quote