View Single Post
10/26/19, 01:25 AM   #1
MethosFrost
AddOn Author - Click to view addons
Join Date: Dec 2018
Posts: 5
While loop breaking ESO

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:
  1. local function RefineKey()
  2.     local function createList()
  3.     local readyRefine = {}
  4.         if not GetRefineItems(BAG_BACKPACK) then readyRefine = false end
  5.         if HasCraftBagAccess() then
  6.             if not GetRefineItems(BAG_VIRTUAL) then readyRefine = false end
  7.         end
  8.    
  9.         if AllCraft_Decon.deconSettings.UseBank then
  10.             if not GetRefineItems(BAG_BANK) then readyRefine = false end
  11.             if IsESOPlusSubscriber() then
  12.                 if not GetRefineItems(BAG_SUBSCRIBER_BANK) then
  13.                     readyRefine = false
  14.                 end
  15.             end
  16.         end
  17.         --**ToBeAdded** check for array add failures.
  18.     end
  19.     createList()
  20.     --**ToBeAdded** reiterate createList as many times as needed to empty all bags.
  21.     d(#RefineList)
  22.     --while #RefineList ~= 0 do
  23.         PrepareDeconstructMessage()
  24.         for index, thing in ipairs(RefineList) do
  25.             AddItemToDeconstructMessage(thing.bagId, thing.slotIndex, thing.quantity)
  26.             table.remove(RefineList, index)
  27.         end
  28.         SendDeconstructMessage()
  29.         createList()
  30.         d(#RefineList)
  31.     --end
  32. end

Last edited by MethosFrost : 10/26/19 at 01:26 AM. Reason: Code Bracket edit
  Reply With Quote