ElvUI-WotLK / ElvUI_AddOnSkins

22 stars 31 forks source link

Missing argument in AddOnSkin ArkInventory.lua #153

Open Bluewine opened 3 years ago

Bluewine commented 3 years ago

Description:

I've enabled ElvUI, disabled the integrated Bag submodule. Then, I've logged out and enabled the ArkInventory addon. Logging back into the game, press the button "B" to open the whole bag, I faced the following error:

Message: Interface\AddOns\ArkInventory\ArkInventory.lua:8024: opt is not a table
Time: 04/14/21 20:25:47
Count: 3
Stack: [C]: ?
[C]: in function `assert'
Interface\AddOns\ArkInventory\ArkInventory.lua:8024: in function <Interface\AddOns\ArkInventory\ArkInventory.lua:8020>
(tail call): ?
...ddOns\ElvUI_AddOnSkins\Skins\Addons\ArkInventory.lua:59: in function <...ddOns\ElvUI_AddOnSkins\Skins\Addons\ArkInventory.lua:56>
[C]: in function `Frame_Main_Anchor_Set'
Interface\AddOns\ArkInventory\ArkInventory.lua:3701: in function `Frame_Main_Scale'
Interface\AddOns\ArkInventory\ArkInventory.lua:3958: in function `Frame_Main_Update'
Interface\AddOns\ArkInventory\ArkInventory.lua:4175: in function `Frame_Main_Draw'
Interface\AddOns\ArkInventory\ArkInventory.lua:3534: in function `Frame_Main_DrawLocation'
Interface\AddOns\ArkInventory\ArkInventory.lua:3525: in function `Frame_Main_Generate'
Interface\AddOns\ArkInventory\ArkInventory.lua:4272: in function `Frame_Main_Show'
Interface\AddOns\ArkInventory\ArkInventory.lua:4236: in function `Frame_Main_Toggle'
Interface\AddOns\ArkInventory\ArkInventory.lua:7818: in function <Interface\AddOns\ArkInventory\ArkInventory.lua:7811>
(tail call): ?
[string "TOGGLEBACKPACK"]:1: in function <[string "TOGGLEBACKPACK"]:1>

Discovery:

The line 59 of this file (the ElvUI AddOnSkin for ArkInventory addon) calls the function ArkInventory.LocationOptionGet from ArkInventory addon ArkInventory.lua file with four (4) parameters. ElvUI AddOnSkin lua file for ArkInventory: image

The ArkInventory addon ArkInventory.lua file defines the above mentioned method to receive only two (2) arguments: function ArkInventory.LocationOptionGet( loc_id, opt ). This function, at same time, calls the other function ArkInventory.LocationOptionGetReal( loc_id, opt ) passing the loc_id and the opt variables.

The function ArkInventory.LocationOptionGetReal( loc_id, opt ) asserts on the type of the opt variable expecting to be a lua table. Addon ArkInventory lua file code section: image

Since the ElvUI AddOnSkin for ArkInventory lua file at the mentioned line 59 is passing incorrect number and type of argument to the function ArkInventory.LocationOptionGet( loc_id, opt ) the assertion mechanism fails and then I'm seeing the mentioned error stack when I open the bag pressing the key "B" in-game.

Solution:

Replace the calling code at the line 59 by this: local anchor = ArkInventory.LocationOptionGet( loc_id, { "anchor", loc_id, "point" } ) enclosing the last three arguments with { }.

This is valid because I was looking into the ArkInventory addon lua file code and found a similar line of code with the same four parameters and names but the last three arguments were enclosed by { }. Addon ArkInventory lua file code section: image

Bluewine commented 3 years ago

With the suggested solution, I no longer see the error and opening the bag won't show those errors anymore