Bagnon

Bagnon

122M Downloads

LUA error in 10.1 when opening bags - Includes workaround/fix (multiple confirmations)

raysmith59 opened this issue ยท 24 comments

commented

31x BagBrother/libs/ItemSearch-1.3-2/API.lua:53: attempt to index field 'args' (a nil value)
[string "@BagBrother/libs/ItemSearch-1.3-2/API.lua"]:53: in function <BagBrother/libs/ItemSearch-1.3/API.lua:50>
[string "@BagBrother/libs/ItemSearch-1.3-2/API.lua"]:58: in function IsUnusable' [string "@BagBrother/addons/core/classes/item.lua"]:243: in function UpdateBorder'
[string "@BagBrother/addons/core/classes/item.lua"]:206: in function <...rfaceBagBrother/addons/core/classes/item.lua:199>
[string "=[C]"]: ?
[string "=[C]"]: in function Update' [string "@BagBrother/addons/core/classes/item.lua"]:134: in function <...rfaceBagBrother/addons/core/classes/item.lua:129> [string "=[C]"]: in function Show'
[string "@BagBrother/addons/core/classes/item.lua"]:47: in function <...rfaceBagBrother/addons/core/classes/item.lua:39>
[string "=(tail call)"]: ?
[string "@BagBrother/addons/core/classes/itemGroup.lua"]:124: in function `func'
[string "@BagBrother/libs/MutexDelay-1.0-2/MutexDelay-1.0.lua"]:36: in function <...ns/BagBrother/libs/MutexDelay-1.0/MutexDelay-1.0.lua:30>

Locals:
lines =

{
1 =
{
}
2 =
{
}
3 =
{
}
4 =
{
}
5 =
{
}
6 =
{
}
7 =
{
}
8 =
{
}
9 =
{
}
10 =
{
}
}
(for index) = 9
(for limit) = 5
(for step) = -1
i = 9
(*temporary) = nil
(*temporary) =
{
leftText = ""
maxPrice = -1
price = 242155
leftColor =
{
}
type = 11
}
(*temporary) = -1
(temporary) = 0
(temporary) = "attempt to index field 'args' (a nil value)"
C =
{
TooltipInfo =
{
}
IsItemCache =
{
}
CurrencyInfo =
{
}
Container =
{
}
}
id = 198992
L =
{
CLASS_REQUIREMENT = "Classes: (.
)"
PLAYER_CLASS = "Hunter"
IN_SET = "Equipment Sets: |cFFFFFFFF(.
)|r"
}

commented

Thanks @rlincoln24 , your fix worked for me as well.

commented

I'm sure this damages some functionality, but this gets to a working state for the main bag functionality.
Commenting out Lines 52->57 of the file BagBrother/libs/API.lua seems to work for me.

commented

Thanks for the update @Salmanius , this worked for me.

One exception the path for ME atleast was BagBrother\libs\ItemSearch-1.3\API.lua

And it's these lines you want to comment out:

		for i = #lines-1, 5, -1 do
			local class = lines[i].args[2].stringVal:match(L.CLASS_REQUIREMENT)
			if class then
				return not class:find(L.PLAYER_CLASS)
			end
		end

You can do so by simply adding 2 dashes before it so it appears like so:

		-- for i = #lines-1, 5, -1 do
			-- local class = lines[i].args[2].stringVal:match(L.CLASS_REQUIREMENT)
			-- if class then
				-- return not class:find(L.PLAYER_CLASS)
			-- end
		-- end
commented

thanks, that works perfectly!

commented

@rlincoln24 You are correct. I misread the path. I could not get the code formatting to work on here for me. Thanks for doing that.

commented

Lines 69-73 should also be commented out in BagBrother\libs\ItemSearch-1.3\API.lua. Without this, you will not be able to view your bank without visiting it. There will be either a blank window or a window with errors. That is, lines 69-73 should look like this:

			--for i = 2, min(4, #lines) do
				--if lines[i].args[2].stringVal:find(ITEM_STARTS_QUEST) then
					--return true
				--end
			--end
commented

Useful note, if you're commenting out multiple lines at once in Lua, you can simply use "--[[" at the start and "]]" at the end to comment out an entire section (sans quotation marks)

commented

Keep in mind that if you do this "fix" items will not show what lvl/class you need to be to equip something

commented

I don't think these changes have anything to do with equipped level restrictions; I don't recall those having a red border for a while. Seems to just be related to class restrictions.

I think I've figured out an actual workaround for the class restriction errors, got the idea from some Hekili code, change all instances of:
args[2].stringVal

to:
leftText

(for example, it would now be lines[i].leftText instead of lines[i].args[2].stringVal)

I found 2 locations in API.lua and 1 in Filters.lua. No errors and things seem to be working as expected (search, bags, bank and remote bank viewing) but no promises, obviously.

commented

All you need to do is replace line 53 with this:

function Lib:IsUnusable(id)
if Unfit:IsItemUnusable(id) then
return true
elseif Lib.Unusable[id] == nil and IsEquippableItem(id) then
Lib.Unusable[id] = (function()
local lines = C.TooltipInfo.GetItemByID(id).lines
for i = #lines-1, 5, -1 do
if lines[i].args ~= nil then -- add this check
local class = lines[i].args[2].stringVal:match(L.CLASS_REQUIREMENT)
if class then
return not class:find(L.PLAYER_CLASS)
end
end
end
end)() or false
end
return Lib.Unusable[id]
end

commented

I don't think these changes have anything to do with iLvl restrictions; I don't recall those having a red border for a while. Seems to just be related to class restrictions.

I think I've figured out an actual workaround for the class restriction errors, got the idea from some Hekili code, change all instances of: args[2].stringVal

to: leftText

(for example, it would now be lines[i].leftText instead of lines[i].args[2].stringVal)

I found 2 locations in API.lua and 1 in Filters.lua. No errors and things seem to be working as expected (search, bags, bank and remote bank viewing) but no promises, obviously.

Thanks for the workaround. Works great!

commented

I don't think these changes have anything to do with equipped level restrictions; I don't recall those having a red border for a while. Seems to just be related to class restrictions.

I think I've figured out an actual workaround for the class restriction errors, got the idea from some Hekili code, change all instances of: args[2].stringVal

to: leftText

(for example, it would now be lines[i].leftText instead of lines[i].args[2].stringVal)

I found 2 locations in API.lua and 1 in Filters.lua. No errors and things seem to be working as expected (search, bags, bank and remote bank viewing) but no promises, obviously.

This didn't work for me unfortunately :/

commented

Thanks, rlincoln24, that worked for me!

commented

I don't think these changes have anything to do with equipped level restrictions; I don't recall those having a red border for a while. Seems to just be related to class restrictions.

I think I've figured out an actual workaround for the class restriction errors, got the idea from some Hekili code, change all instances of: args[2].stringVal

to: leftText

(for example, it would now be lines[i].leftText instead of lines[i].args[2].stringVal)

I found 2 locations in API.lua and 1 in Filters.lua. No errors and things seem to be working as expected (search, bags, bank and remote bank viewing) but no promises, obviously.

This worked very well for me.

commented

I don't think these changes have anything to do with equipped level restrictions; I don't recall those having a red border for a while. Seems to just be related to class restrictions.

I think I've figured out an actual workaround for the class restriction errors, got the idea from some Hekili code, change all instances of: args[2].stringVal

to: leftText

(for example, it would now be lines[i].leftText instead of lines[i].args[2].stringVal)

I found 2 locations in API.lua and 1 in Filters.lua. No errors and things seem to be working as expected (search, bags, bank and remote bank viewing) but no promises, obviously.

This is the one that got it working for me as well. Thank you

commented

How do i find the folder to put the above in bagnon?

commented

Unzip the files and put it in retail\Interface\Addons\BagBrother\libs\ItemSearch-1.3\

Archive contains updated files with mentioned fixes

Archive.zip

commented

That worked thank you !

commented

All you need to do is replace line 53 with this:

Thanks, this seems to have fixed it for me.

I've included it here with the proper formatting. You should be able to just replace the existing function on lines 46-61 with this block in \_retail_\Interface\AddOns\BagBrother\libs\ItemSearch-1.3\API.lua. It just checks to make sure the arguments exist before trying to do stuff with the arguments.

function Lib:IsUnusable(id)
	if Unfit:IsItemUnusable(id) then
		return true
	elseif Lib.Unusable[id] == nil and IsEquippableItem(id) then
		Lib.Unusable[id] = (function()
			local lines = C.TooltipInfo.GetItemByID(id).lines
			for i = #lines-1, 5, -1 do
				if lines[i].args ~= nil then --Add this check
					local class = lines[i].args[2].stringVal:match(L.CLASS_REQUIREMENT)
					if class then
						return not class:find(L.PLAYER_CLASS)
					end
				end --End additional check
			end
		end)() or false
	end
	return Lib.Unusable[id]
end
commented

I think I've figured out an actual workaround for the class restriction errors, got the idea from some Hekili code, change all instances of: args[2].stringVal

to: leftText

(for example, it would now be lines[i].leftText instead of lines[i].args[2].stringVal)

I found 2 locations in API.lua and 1 in Filters.lua. No errors and things seem to be working as expected (search, bags, bank and remote bank viewing) but no promises, obviously.

got this working, tyvm!!
I just wanted to say, why this might not work for some people, is the line in filters file is slightly different. to clarify:
the API file has 2 lines, line 53 and 70

change 53 to
local class = lines[i].leftText:match(L.CLASS_REQUIREMENT)

and 70 to
if lines[i].leftText:find(ITEM_STARTS_QUEST) then

then in filters file,
change 44 to
if Parser:Find(search, line.leftText) then

all other workarounds / changes / linked files -did- get basic functionality working, but only this change made to the oiginal files fixed it /AND/ restored search function.

thanks

commented

Unfortunately, the new version (from CurseForge) contains a lot of issues. The level of things in the bag is not shown, Blizzard constantly blocks the addon when using items from bags, and personalization of settings does not work. On the old version with the replacement of the file in ItemSearch-1.3 everything is OK

commented

hxxps://mega.nz/file/d0pT2JzR#ajMvjMNoe2nhB2fvgps71_3Afa_JhdKMPN-UsrGFipE

@rionshin - sorry i'm not actually intelligent enough to parse through anything. i'm just a regular neckbeard that made a few changes based on the previous comment and they worked. But i zipped up my itemsearch folder so you can either use it or look through my files to see if you can spot the difference.

one theory would be that because bagnon's development has been less than smooth, we each might be putting band aids on top of previous band aids. so that could account for any given step or workaround not being complete. unfortunately this means that simply copying -my- itemsearch folder also might not work. but here it is. ^_^

hopefully the issues in the new 10.1 (only saw it on curseforge site, not the app yet) update file can be resolved "soon"

commented

@bahahamut there is something wrong with filters.lua and i cannot figure it out, i am still getting this error and search is not working . Something is wrong in line 44.

24x ...ceBagBrother/libs/ItemSearch-1.3-4/Filters.lua:44: attempt to index global 'lines' (a nil value)
[string "@BagBrother/libs/ItemSearch-1.3-4/Filters.lua"]:44: in function <...ceBagBrother/libs/ItemSearch-1.3/Filters.lua:37>
[string "=(tail call)"]: ?
[string "@BagBrother/libs/CustomSearch-1.0-10/CustomSearch-1.0.lua"]:115: in function Filter' [string "@BagBrother/libs/CustomSearch-1.0-10/CustomSearch-1.0.lua"]:87: in function Match'
[string "@BagBrother/libs/CustomSearch-1.0-10/CustomSearch-1.0.lua"]:49: in function MatchAny' [string "@BagBrother/libs/CustomSearch-1.0-10/CustomSearch-1.0.lua"]:39: in function <...agBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:37> [string "=(tail call)"]: ? [string "=(tail call)"]: ? [string "@BagBrother/addons/core/classes/item.lua"]:297: in function ?'
[string "@AutoCombatLogger/Libs/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:109: in function <...ger/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:109>
[string "=[C]"]: ?
[string "@AutoCombatLogger/Libs/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:19: in function <...ger/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:15>
[string "@AutoCombatLogger/Libs/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:54: in function SendMessage' [string "@BagBrother/libs/WildAddon-1.0-1/WildAddon-1.0.lua"]:83: in function SendSignal'
[string "@Bagnon/src/searchFrame.lua"]:78: in function <Bagnon/src/searchFrame.lua:74>

Locals:
self =

{
match = defined @BagBrother/libs/ItemSearch-1.3/Filters.lua:37
canSearch = defined @BagBrother/libs/ItemSearch-1.3/Filters.lua:33
onlyTags = false
tags =
{
}
}
item =
{
location =
{
}
link = "|cff1eff00|Hitem:200093::::::::70:70:::::::::|h[Centaur Hunting Trophy]|h|r"
}
_ = nil
search = "d"
where =
{
slotIndex = 6
bagID = 0
}
data =
{
dataInstanceID = 4175
type = 0
isAzeriteItem = false
guid = "Item-3674-0-40000009C9864606"
id = 200093
isAzeriteEmpoweredItem = false
isCorruptedItem = false
lines =
{
}
}
(for generator) = defined =[C]:-1
(for state) =
{
1 =
{
}
2 =
{
}
3 =
{
}
4 =
{
}
}
(for control) = 1
i = 1
line =
{
leftColor =
{
}
type = 29
leftText = "Centaur Hunting Trophy"
}
(*temporary) = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:132
(*temporary) =
{
object =
{
}
filters =
{
}
OR = "or"
NOT_MATCH = "not"
NOT = "Not"
Find = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:132
Match = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:55
MatchAny = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:47
ACCENTS =
{
}
MatchAll = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:37
UseFilter = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:122
Compare = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:152
Matches = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:28
Filter = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:100
Clean = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:141
}
(*temporary) = "d"
(*temporary) = nil
(*temporary) = "attempt to index global 'lines' (a nil value)"
C =
{
TooltipInfo =
{
}
IsItemCache =
{
}
CurrencyInfo =
{
}
Container =
{
}
}
Parser =
{
object =
{
}
filters =
{
}
OR = "or"
NOT_MATCH = "not"
NOT = "Not"
Find = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:132
Match = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:55
MatchAny = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:47
ACCENTS =
{
}
MatchAll = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:37
UseFilter = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:122
Compare = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:152
Matches = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:28
Filter = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:100
Clean = defined @BagBrother/libs/CustomSearch-1.0/CustomSearch-1.0.lua:141
}

commented

It has been updated on curse now