I'm slowly working on an addon that includes auto refining and I'm having an issue with the while loop locking up ESO completely. Has anyone seen this type of issue or can someone smarter than me think of a way around the issue? Everything in this code works until I uncomment the (while do end) and I get the expected array count on the testing output.
NOTE-- I added the table remove to find a way around this issue thinking the array wasn't empty.
Lua Code:
local function RefineKey()
local function createList()
local readyRefine = {}
if not GetRefineItems(BAG_BACKPACK) then readyRefine = false end
if HasCraftBagAccess() then
if not GetRefineItems(BAG_VIRTUAL) then readyRefine = false end
end
if AllCraft_Decon.deconSettings.UseBank then
if not GetRefineItems(BAG_BANK) then readyRefine = false end
if IsESOPlusSubscriber() then
if not GetRefineItems(BAG_SUBSCRIBER_BANK) then
readyRefine = false
end
end
end
--**ToBeAdded** check for array add failures.
end
createList()
--**ToBeAdded** reiterate createList as many times as needed to empty all bags.
d(#RefineList)
--while #RefineList ~= 0 do
PrepareDeconstructMessage()
for index, thing in ipairs(RefineList) do
AddItemToDeconstructMessage(thing.bagId, thing.slotIndex, thing.quantity)
table.remove(RefineList, index)
end
SendDeconstructMessage()
createList()
d(#RefineList)
--end
end