Thread: the _G changes.
View Single Post
09-17-10, 07:52 AM   #3
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
hmmm, well im still confused then about one change or another. I get what appears to be the same value = nil error on a few different chunks of code. some of the chunks are as follows.

lua Code:
  1. local function CreateBorders(frame, prefix)
  2.     local border, start = { }, frame == CharacterFrame and 0 or 1
  3.     for id = start, #slots do
  4.         local frame = _G[prefix .. slots[id]]
  5.         local region = GetNormalTexture(frame:GetRegions())
  6.         local texture = frame:CreateTexture(nil, 'OVERLAY')
  7.         texture:SetTexture([[Interface\Buttons\UI-ActionButton-Border]])
  8.         texture:SetBlendMode('ADD')
  9.         texture:SetAlpha(0.8)
  10.         texture:SetPoint('TOPLEFT', region, -1, 3)
  11.         texture:SetPoint('BOTTOMRIGHT', region, 1, 0)
  12.         border[id] = texture
  13.     end
  14.     borders[frame] = border
  15. end
  16.  
  17. local function OnHide(self)
  18.     addon.UnregisterEvent(self, 'UNIT_INVENTORY_CHANGED')
  19. end
  20.  
  21. local function OnShow(self)
  22.     addon.RegisterEvent(self, 'UNIT_INVENTORY_CHANGED', UpdateItemQualityBorders)
  23.     UpdateItemQualityBorders(self, nil, self.unit)
  24. end
  25.  
  26. local function HookFrame(frame, prefix)
  27.     CreateBorders(frame, prefix)
  28.     frame:HookScript('OnHide', OnHide)
  29.     frame:HookScript('OnShow', OnShow)
  30. end
  31.  
  32. HookFrame(CharacterFrame, 'Character')
  33. CharacterFrame.unit = 'player'
  34.  
  35. if InspectFrame then
  36.     HookFrame(InspectFrame, 'Inspect')
  37. else
  38.     addon.RegisterEvent("Features-MonitorInspectUI", 'ADDON_LOADED', function(self, event, name)
  39.         if name ~= 'Blizzard_InspectUI' then return end
  40.         addon.UnregisterEvent(self, event)
  41.  
  42.         HookFrame(InspectFrame, 'Inspect')
  43.         if InspectFrame:IsShown() then
  44.             UpdateItemQualityBorders(InspectFrame, nil, InspectFrame.unit)
  45.         end
  46.     end)
  47. end

or this chunk

lua Code:
  1. hooksecurefunc('FriendsList_Update', function()
  2.     local buttons, button = FriendsFrameFriendsScrollFrame.buttons
  3.     local colors, CLASS = CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS, addon.CLASS
  4.     for index = 1, FriendsFrameFriendsScrollFrame.usedButtons do
  5.         button = buttons[index]
  6.         if button.buttonType == FRIENDS_BUTTON_TYPE_WOW then
  7.             local _, _, class, _, connected = GetFriendInfo(button.id)
  8.             if connected then
  9.                 local color = colors[CLASS[class]]
  10.                 button.name:SetTextColor(color.r, color.g, color.b)
  11.             end
  12.         end
  13.     end
  14. end)

and last but not least this chunk also
lua Code:
  1. _G.SlashCmdList["GTIPNOTES_SHORTHAND"] = function(input)
  2.     if not UnitExists("target") then
  3.         DEFAULT_CHAT_FRAME:AddMessage(TARGET_ERROR)
  4.         return
  5.     end
  6.     if type(input) ~= "string" or input:trim():len() == 0 then
  7.         if not StaticPopupDialogs["GTipNotes"] then
  8.             StaticPopupDialogs["GTipNotes"] = {
  9.                 text = nil,
  10.                 button1 = SET,
  11.                 button2 = CANCEL,
  12.                 whileDead = 1,
  13.                 hideOnEscape = 1,
  14.                 timeout = 0,
  15.                 OnShow = function()
  16.                     -- We have to do this onshow to reset the previous text
  17.                     local t = UnitExists("target") and UnitName("target") or ""
  18.                     _G[this:GetName().."EditBox"]:SetText(_G.GTipNotesDB[t] or "")
  19.                 end,
  20.                 OnHide = function()
  21.                     _G[this:GetName().."EditBox"]:SetText("")
  22.                 end,
  23.                 EditBoxOnEnterPressed = function()
  24.                     addNoteFromPopup(_G[this:GetParent():GetName().."EditBox"]:GetText())
  25.                     this:GetParent():Hide()
  26.                 end,
  27.                 EditBoxOnEscapePressed = function()
  28.                     this:GetParent():Hide()
  29.                 end,
  30.                 OnAccept = function()
  31.                     addNoteFromPopup(_G[this:GetParent():GetName().."EditBox"]:GetText())
  32.                 end,
  33.                 hasEditBox = 1,
  34.             }
  35.         end
  36.         StaticPopupDialogs["GTipNotes"].text = POPUP_TEXT:format(UnitName("target"))
  37.         StaticPopup_Show("GTipNotes")
  38.     else
  39.         local t = UnitName("target")
  40.         _G.GTipNotesDB[t] = input
  41.         DEFAULT_CHAT_FRAME:AddMessage(NOTE_SET:format(t, input))
  42.     end
  43. end

all works on live servers so it has to be the cata changes that caused this im just not sure which one or why.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]