Index field 'Money' nil value #358


  • New
Closed
  • sixftrabbit created this issue Oct 21, 2019

    If you're reporting a problem, please ALWAYS include the following information or I won't be able to help you!  (Suggestions or feature requests need not use this template)

    • Addon version (Example: r664-alpha)
    • Did you RESTART the game after updating the addon? (Make sure to exit and close fully the client, and not just reload your UI, to detect newly-added files)
    • Steps to reproduce the error or unwanted behaviour (If the addon won't load, make sure to enable script errors!)
    • Any other information you consider relevant or helpful in solving the problem (Screenshots, expected behaviour, things you already tried to fix the issue...)

     Thank you for understanding! It's not always easy to troubleshoot problems. Please don't make it more difficult by disregarding these suggestions.

    Addon version - Latest r692-release

    Restart - Not a new install

    When I first login to the game I get this error. I have got it other times while looting but nothing I can reproduce. The only thing constant is when I first login the game I get this. I can't tell if this is an issue with Rarity or Draenor Treausres since it is also mentioned in the error:

     

    Message: Interface\AddOns\Rarity\Core.lua:3940: attempt to index field 'Money' (a nil value)
    Time: Mon Oct 21 13:09:45 2019
    Count: 1
    Stack: Interface\AddOns\Rarity\Core.lua:3940: attempt to index field 'Money' (a nil value)
    [C]: ?
    Interface\AddOns\Rarity\Core.lua:3940: in function <Interface\AddOns\Rarity\Core.lua:3693>
    Interface\AddOns\Rarity\Core.lua:4074: in function `ShowTooltip'
    Interface\AddOns\Rarity\Core.lua:894: in function `func'
    ..._DraenorTreasures\libs\AceTimer-3.0\AceTimer-3.0.lua:55: in function <..._DraenorTreasures\libs\AceTimer-3.0\AceTimer-3.0.lua:48>

  • sixftrabbit added a tag New Oct 21, 2019
  • Quartzfire posted a comment Oct 22, 2019

    Also reported under ticket # 356 ==>> https://www.curseforge.com/wow/addons/rarity/issues/356

     

    I looked at Core.lua around lines 3940, which look like this:

    3938     if TSMAPI_FOUR then

    3939          marketPrice = TSMAPI_FOUR.CustomPrice.GetItemPrice(v.itemId, 'DBMarket')

    3940          marketPrice = TSMAPI_FOUR.Money.ToString(marketPrice)

    3941     end

     

    Firstly I tried to disable the option in Rarity called, "Show TSM Column", but it made no difference.


    Then, I disabled TSM from loading, and that didn't cause Rarity to crash - so I think it's related to Rarity&TSM combination.

     

    Then, since I have a lot of addons, I disabled all addons except TSM and Rarity - and I get the Lua error - so I think even more it's related to Rarity&TSM combination.


    Edited Oct 22, 2019
  • Uenu posted a comment Oct 22, 2019

    quartzfire

     

    Indeed that is the like causing problems.  After reviewing Rarity AND TSM4, it appears that recently they removed the TSMAPI_FOUR.Money.* functions.  Whether by design, or accident, those API functions no longer exist, and have been merged to the non-public functions only.  Here's the simple modification I made to TSM4 to get Rarity working again.  There may be a better way to make Rarity work with the new TSM, but this was the quick fix to make TSM work with Rarity.

     

    *** Core/Util/Money.lua 2019-10-22 14:47:14.892395266 -0500
    --- Core/Util/Money.lua 2019-10-22 14:47:26.802197506 -0500
    ***************
    *** 12,17 ****
    --- 12,18 ----
      local _, TSM = ...
      TSM.Money = {}
      local Money = TSM.Money
    + TSMAPI_FOUR.Money = {}
      local private =  { textMoneyParts = {} }
      local GOLD_ICON = "|TInterface\\MoneyFrame\\UI-GoldIcon:0|t"
      local SILVER_ICON = "|TInterface\\MoneyFrame\\UI-SilverIcon:0|t"
    ***************
    *** 144,149 ****
    --- 145,158 ----
          return ((gold or 0) * COPPER_PER_GOLD) + ((silver or 0) * COPPER_PER_SILVER) + (copper or 0)
      end
    
    + function TSMAPI_FOUR.Money.ToString(value, color, ...)
    +  return Money.ToString(value, color)
    + end
    +
    + function TSMAPI_FOUR.Money.FromString(value)
    +  return Money.FromString(value)
    + end
    +
    
      -- ============================================================================
      -- Helper Functions
    

     

  • lunaferret posted a comment Oct 25, 2019

    The above fixed it for me, although it's worth mentioning that my Core/Util/Money.lua looked different. 

     

    I added TSMAPI_FOUR.Money = {} where indicated, just after local Money = TSM.Money, and then the bottom portion just above the "Helper Functions" area, but most of what is in between is different. 

  • raymbec32 posted a comment Oct 27, 2019

    hi guys. pls tell me how use this fix where to go where to write idont know how and where write this fixes help me plz.

  • Nozzzztraaa posted a comment Oct 27, 2019
    New TSM version was released today and this fix is no longer applicable, sorry :(
  • Nozzzztraaa posted a comment Oct 27, 2019
    I have just tried a new fix. This time applied to Rarity directly to prevent any further issues with TSM updates. 1) make sure "Show TSM Column" is not enabled in your Rarity add-on options. 2) go to /Rarity/Core.lua 3) on line 3938 change "if TSMAPI_FOUR then" to "if TSMAPI_FOUR and Rarity.db.profile.showTSMColumn then" Now there are no TSM function calls if "Show SM Column" is disabled.
  • lunaferret posted a comment Oct 27, 2019

    Confirmed, Nozz's fix fixed the unfixed fix.

  • Uenu posted a comment Oct 27, 2019

    I've come up with a couple of options, one TSM based, and one Rarity based (similar to Nozz's).  As Rarity tends to update at a slower rate, I recommend Option 2, or just use Nozz's.

     

    Option 1

    Another short-term TSM fix is now in TradeSkillMaster\LibTSM\Util\Money.lua, they update this addon fairly often.

     

    TSM Fix Option

    This appears to work.  Around line 15, or so, you should find

    TSM.Money = Money

     

    Add a new line just below it, so it looks like this...

    TSM.Money = Money
    TSMAPI_FOUR.Money = Money

     

    Rarity Fix Non-Option

    This doesn't work.  I tried updating Rarity\Core.lua where

    -- TSM Pricing
    local TSMAPI_FOUR = TSMAPI_FOUR

     

    to 

    -- TSM Pricing
    local TSMAPI_FOUR = TSM

     

    but because TSM still declares TSM as local, Rarity cannot access it.  But elsewhere in TSM, TSMAPI_FOUR is not local, so that works.

     

    Option 2

    Another possible Rarity only fix is similar to Nozz's fix.  It ensures that not only does TSM export TSMAPI_FOUR, but also declares TSMAPI_FOUR.Money,

    this maintains existing Rarity functionality, instead of potentially adding a new purpose to an existing setting (called overloading in programming terms).

     

    Around line 3938, change

    if TSMAPI_FOUR then

     

    to

    if TSMAPI_FOUR and TSMAPI_FOUR.Money then

     

  • raymbec32 posted a comment Oct 28, 2019
     ty u the best!
  • sixftrabbit posted a comment Oct 29, 2019

    Nozzzztraaa

     

    That fix seems to work for me so far! Thank you

  • Cakechart posted a comment Nov 6, 2019

    Sorry for the delay. I'm looking into it and will try to find a way to make the feature work again.

     

    No ETA, but it might be a few days, as I just returned and have to catch up on lots of issues that have piled up in my absence.

     

    Status: https://github.com/SacredDuckwhale/Rarity/issues/139

  • farmacitrona posted a comment Nov 10, 2019

     Uenu tymv for your help!

  • Cakechart posted a comment Nov 22, 2019

    A fix has been added to the latest alpha version. Feel free to report back if there are any other issues! :)

  • Cakechart closed issue Nov 22, 2019

To post a comment, please login or register a new account.