WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   bizarre SetFontObject() issue (https://www.wowinterface.com/forums/showthread.php?t=59482)

Walkerbo 01-22-23 10:56 PM

bizarre SetFontObject() issue
 
Hi all

This is a bit of a strange one.

I am the author of NewbDevBox and have struck a strange bug.
With the launch of Ulduar in Wrath Classic my addon stopped working yet the same code still works in both Classic and Retail.

The bugsack report is:
Lua Code:
  1. 23x Interface/AddOns/NewbDevBox/NewbDevBox.lua:688: attempt to index field '?' (a nil value)
  2. [string "@Interface/AddOns/NewbDevBox/NewbDevBox.lua"]:688: in main chunk
  3.  
  4. Locals:
  5. addonName = "Newb Dev Box 4 Wrath"
  6. versionNumber = "NDB4Wrath 2.1.3.4"
  7. ListOfDevAddons = <table> {
  8.  1 = "BugSack"
  9.  2 = "REHack"
  10.  3 = "ViragDevTool"
  11.  4 = "WowLua"
  12.  5 = "APIInterface"
  13.  6 = "HandleIt"
  14.  7 = "WhatsOnTheMap"
  15.  8 = "Cube"
  16.  9 = "AddonUsage"
  17. }
  18. bugsackFunctions = <table> {
  19.  FormatError = <function> defined @Interface/AddOns/BugSack/core.lua:218
  20.  UpdateDisplay = <function> defined =[C]:-1
  21.  ColorLocals = <function> defined @Interface/AddOns/BugSack/core.lua:200
  22.  GetErrors = <function> defined @Interface/AddOns/BugSack/core.lua:167
  23.  SendCommMessage = <function> defined @Interface/AddOns/BugSack/Libs/AceComm-3.0/AceComm-3.0.lua:87
  24.  OnBugComm = <function> defined @Interface/AddOns/BugSack/core.lua:252
  25.  L = <table> {
  26.  }
  27.  healthCheck = true
  28.  UnregisterAllComm = <function> defined @Interface/AddOns/BugSack/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:174
  29.  Serialize = <function> defined @Interface/AddOns/BugSack/Libs/AceSerializer-3.0/AceSerializer-3.0.lua:122
  30.  RegisterComm = <function> defined @Interface/AddOns/BugSack/Libs/AceComm-3.0/AceComm-3.0.lua:60
  31.  db = <table> {
  32.  }
  33.  ColorStack = <function> defined @Interface/AddOns/BugSack/core.lua:186
  34.  Deserialize = <function> defined @Interface/AddOns/BugSack/Libs/AceSerializer-3.0/AceSerializer-3.0.lua:246
  35.  UnregisterComm = <function> defined @Interface/AddOns/BugSack/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:153
  36.  OpenSack = <function> defined @Interface/AddOns/BugSack/sack.lua:458
  37.  SendBugsToUser = <function> defined @Interface/AddOns/BugSack/core.lua:238
  38.  frame = Frame {
  39.  }
  40.  CloseSack = <function> defined @Interface/AddOns/BugSack/sack.lua:454
  41.  Reset = <function> defined @Interface/AddOns/BugSack/core.lua:231
  42. }
  43. SortedNewbDevBoxButtonTable = <table> {
  44. }
  45. stringNewbDevBox = "Newb Dev Box"
  46. stringKeyBindings = "Keybindings"
  47. stringToggleFrame = "Toggle Frame"
  48. stringReload = "Reload"
  49. stringLogout = "Logout"
  50. stringFStack = "FStack"
  51. stringETrace = "ETrace"
  52. stringChatLog = "Chat Log"
  53. stringCombatLog = "Combat Log"
  54. stringClearChat = "Clear Chat"
  55. stringChatSpacer = "Chat Spacer"
  56. stringETraceStart = "ETrace Start"
  57. stringETraceStop = "ETrace Stop"
  58. stringExit = "Exit"
  59. stringBugSack = "Bug Sack"
  60. stringBugSackClear = "Clear Bug Sack"
  61. stringWoWLuaButton = "WoW Lua"
  62. stringREHackButton = "REHack"
  63. stringViragDevTool = "Virag Dev Tool"
  64. stringAPIInterface = "API Interface"
  65. stringHandleIt = "Handle It"
  66. stringVersion = "Version"
  67. stringVersionPrint = "Current Version -:"
  68. stringFrameScale = "% Button Box Scale"
  69. stringFrameOpacity = "% Button Box Opacity"
  70. stringWhatsOnTheMapButton = "Whats On The Map"
  71. stringCubeCodeButton = "Cube Code"
  72. stringCubeBrowserButton = "Cube Browser"
  73. stringAddonUsageButton = "Addon Usage"
  74. TextDimensionList = <table> {
  75.  checkBoxFont = FocusFontSmall {
  76.  }
  77.  secureButtonTemplate = "SecureActionButtonTemplate, GameMenuButtonTemplate"
  78.  colourBackdrop = <table> {
  79.  }
  80.  buttonTemplate = "GameMenuButtonTemplate"
  81.  buttonFont = Game13FontShadow {
  82.  }
  83.  checkBoxTextColour = "|cffffd100"
  84.  addonColour = "|cff00ff00"
  85.  disabledTextColour = "|cff918f8e"
  86.  keybindButtonFont = ErrorFont {
  87.  }
  88.  colourBorder = <table> {
  89.  }
  90. }
  91. NewbDevBoxTitle = NewbDevBoxTitle {
  92.  0 = <userdata>
  93. }
  94. NewbDevBoxButton = NewbDevBoxButton {
  95.  0 = <userdata>
  96. }
  97. TextStringList = <table> {
  98.  btnBugSackClearButton = "Clear Bug Sack"
  99.  btnChatSpacer = "Chat Spacer"
  100.  printVersion = "|cff00ff00Current Version -:"
  101.  addonLoaded = "|cff00ff00 *** Newb Dev Box 4 Wrath - NDB4Wrath 2.1.3.4 Loaded ***
  102. "
  103.  btnWhatsOnTheMapButton = "Whats On The Map"
  104.  cbAPIInterfaceButton = " API Interface"
  105.  cbLogout = " Logout"
  106.  btnVersionButton = "Version"
  107.  cbChatLog = " Chat Log"
  108.  btnETrace = "ETrace"
  109.  cbCubeBrowserButton = " Cube Browser"
  110.  cbCombatLog = " Combat Log"
  111.  btnAPIInterfaceButton = "API Interface"
  112.  btnViragDevToolButton = "Virag Dev Tool"
  113.  btnLogout = "Logout"
  114.  cbClearChat = " Clear Chat"
  115.  textBoxScale = "% Button Box Scale"
  116.  cbBugSackClearButton = " Clear Bug Sack"
  117.  printChatSpacer = "|cff00ff00********************************************************"
  118.  btnEtraceStop = "ETrace Stop"
  119.  cbWoWLuaButton = " WoW Lua"
  120.  btnCubeButton = "Cube Code"
The error report points to line 688.

Here is the checkbox code chunk:
Lua Code:
  1. local NewbDevBoxInterfaceFramecbLogoutButton =
  2.     CreateFrame(
  3.     "CheckButton",
  4.     "NewbDevBoxInterfaceFramecbLogoutButton",
  5.     NewbDevBoxInterfaceFrame,
  6.     "UICheckButtonTemplate"
  7. )
  8. NewbDevBoxInterfaceFramecbLogoutButton:SetSize(NumberList.checkBoxSize, NumberList.checkBoxSize)
  9. NewbDevBoxInterfaceFramecbLogoutButton:SetPoint(
  10.     "TOPLEFT",
  11.     NewbDevBoxInterfaceFrame,
  12.     "TOPLEFT",
  13.     NumberList.checkBoxMainSideGap,
  14.     NumberList.checkBoxMainTopGap
  15. )
  16. NewbDevBoxInterfaceFramecbLogoutButton.text:SetFontObject(TextDimensionList.checkBoxFont)
  17. NewbDevBoxInterfaceFramecbLogoutButton.text:SetText(TextStringList.cbLogout)
  18. NewbDevBoxInterfaceFramecbLogoutButton:SetScript(
  19.     "OnClick",
  20.     function()
  21.         if NewbDevBoxDisplayButtonsList[1].LogoutButton then
  22.             NewbDevBoxDisplayButtonsList[1].LogoutButton = false
  23.         else
  24.             NewbDevBoxDisplayButtonsList[1].LogoutButton = true
  25.         end
  26.         buttonFrameButtonLayout()
  27.     end
  28. )
Line 16 is the line 688 in my full code is posted on my pastebin.

Really shaking my head over this one.

Fizzlemizz 01-22-23 11:46 PM

The .text should have a capital T

Walkerbo 01-23-23 03:17 PM

Hi Fizzlemizz

That was it; in Classic it is .text: and in Wrath Classic it needs .Text:

Thanks so much :)

SDPhantom 01-23-23 07:22 PM

Retail has it as .Text too, but it runs an OnLoad script that copies the pointer to .text for backwards compatibility. Wrath 3.4.1 neglects to do this.


All times are GMT -6. The time now is 01:03 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI