DataTexts - Events must be registered as a table #1


Open
  • CarpeDiemVF created this issue Aug 24, 2020

    I have been having an error upon load in that I finally had time to research. I will post the message from the error. I also found the fix for it as BenikUI was having a similar issue.

     

    Message: ...terface\AddOns\ElvUI\Modules\DataTexts\DataTexts.lua:760: Events must be registered as a table.
    Time: Mon Aug 24 15:10:41 2020
    Count: 1
    Stack: ...terface\AddOns\ElvUI\Modules\DataTexts\DataTexts.lua:760: Events must be registered as a table.
    [string "=[C]"]: ?
    [string "@Interface\AddOns\ElvUI\Modules\DataTexts\DataTexts.lua"]:760: in function `RegisterDatatext'
    [string "@Interface\AddOns\ElvUI_CliqueDatatext\CliqueDatatext.lua"]:68: in main chunk

    Locals: (*temporary) = "Events must be registered as a table."

     

    This error has to do with a change in the way Elvui has signed their RegisterDatatext function. In front of the events table there is a category request.  ElvUI updated the signature but not the API comments for using the function and as such your call on line 68 is missing a piece of the signature which is putting the events table in the category variable and the eventfunction in the events table. I was able to get rid of the error by adding " nil," in front of the event table.

     

    Your code line 68 is as follows:

    DT:RegisterDatatext('Clique', {'PLAYER_ENTERING_WORLD'}, OnEvent, nil, OnClick, OnEnter)
    The signature in ElvUI\Modules|DataTexts\DataTexts.lua is as follows:
    DT:RegisterDatatext(name, category, events, eventFunc, updateFunc, clickFunc, onEnterFunc, onLeaveFunc, localizedName, objectEvent)
     
    My fix to line 68 is as follows:
    DT:RegisterDatatext('Clique', nil, {'PLAYER_ENTERING_WORLD'}, OnEvent, nil, OnClick, OnEnter)
    I hope this helps. 

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