View Single Post
01-05-13, 08:27 PM   #18
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
It might be a good idea to add something like "or not self.action" to the "return end" statement at the top just in case it tries to apply to a button without that attribute for some reason.
Lua Code:
  1. local oSetAttribute = getmetatable(ActionButton1).__index.SetAttribute
  2. hooksecurefunc(getmetatable(ActionButton1).__index, 'SetAttribute', function(self, attribute)
  3.     if attribute ~= 'showgrid' or GetCVar('alwaysShowActionBars') ~= '0' or not self.action then return end
  4.     oSetAttribute(self, 'showgrid', GetCursorInfo() and 1 or 0)
  5.     if not HasAction(self.action) then self:Hide() end
  6. end)
  Reply With Quote