Okay, so, there is a problem - some addons (i.e. crapngray, necrosis) crashing session and kick me out to the login screen when I'm trying to delete multiple items at the same time.

I'm aware about that thing that warmane have protection that prevents deleting items automatically. I even found similar topics on this forum like this one .
As Islingr mentioned:
Warmane, about 2 years ago, disabled the DeleteCursorItem() method and made it log the player out instead.

this might have been an over-the-top response to people getting ****ed over by malicious "friends" giving "helpful macros" which end up with all of the player's gear being basically "deleted"
But! What I found is that DeleteCursorItem() method not actually disabled, because when I'm using crapngray I can press addon button multiple times using LMB (which delete 1 gray item at a time), but when I press RMB (which should delete all gray items in the bags) it crashes. Same thing with necrosis's auto deleting soul shards. If it deleting one shard it's fine, but sometimes it bugs out and trying to delete 2 and more shards at the same time and you guess it - it crashes the game and not even letting me enter the game anymore because every time I load my character necrosis automatically trying to delete items again and it just enters disconnect-loop until I disable the addon before entering world.

Here is a video that depict the problem. As you can see I deleted 2 items with LMB with no problem, but when I pressed RMB and it tried to delete multiple items session crashed.



So my first thought was "Okay whatever I need to just add a delay between destroying items". I found a piece of code inside necrosis that delete soul shards, but I stumbled upon a big problem. LUA don't have sleep() method. It has C_Timer.After but unfortunately it was implemented only in wow 6.0.2. I found multiple examples of manual implementation of sleep method on stackoverflow, but I'm not a programmer and it was beyond my abilities to adapt it to my needs.

What I'm asking right now is if someone aware how to do it? Or maybe there is another solution for this?
Here is the part of a code that deleting items in necrosis:
Code:
	-- Destroy extra shards (if enabled) || Si il y a un nombre maximum de fragments à conserver, on enlève les supplémentaires
	if NecrosisConfig.DestroyShard
		and NecrosisConfig.DestroyCount
		and NecrosisConfig.DestroyCount > 0
		then
			for container = 0, 4, 1 do
				if Local.BagIsSoulPouch[container + 1] then break end
				for slot=1, GetContainerNumSlots(container), 1 do
					local itemLink = GetContainerItemLink(container, slot)
					if (itemLink) then
						local _, itemID = strsplit(":", itemLink)
						itemID = tonumber(itemID)
						if (itemID == 6265) then
							if (NecrosisConfig.DestroyCount < Local.Soulshard.Count) then
								PickupContainerItem(container, slot)
								if (CursorHasItem()) then
									DeleteCursorItem()
									Local.Soulshard.Count = GetItemCount(6265)
								end 
							end
							break
						end
					end
				end
				if NecrosisConfig.DestroyCount >= Local.Soulshard.Count then break end
			end
	end
Here is a link to necrosis version that I'm using, the file with the code above is a Necrosis.lua