Commit 30298448 authored by Simpy's avatar Simpy 🐹
Browse files

use better variable names in E:Delay that doesn't shadow existing variables

parent 24417d3e
......@@ -285,7 +285,7 @@ end
local waitTable = {}
local waitFrame
function E:Delay(delay, func, ...)
if(type(delay)~="number" or type(func)~="function") then
if (type(delay) ~= "number") or (type(func) ~= "function") then
return false
end
local extend = {...}
......@@ -293,22 +293,22 @@ function E:Delay(delay, func, ...)
C_Timer_After(delay, func)
return true
else
if(waitFrame == nil) then
if waitFrame == nil then
waitFrame = CreateFrame("Frame","WaitFrame", E.UIParent)
waitFrame:SetScript("onUpdate",function (_,elapse)
local count = #waitTable
local i = 1
while(i<=count) do
local waitRecord = tremove(waitTable,i)
local delay = tremove(waitRecord,1)
local func = tremove(waitRecord,1)
local params = tremove(waitRecord,1)
if(delay>elapse) then
tinsert(waitTable,i,{delay-elapse,func,params})
i = i + 1
local waitRecord, waitDelay, waitFunc, waitParams
local i, count = 1, #waitTable
while i <= count do
waitRecord = tremove(waitTable,i)
waitDelay = tremove(waitRecord,1)
waitFunc = tremove(waitRecord,1)
waitParams = tremove(waitRecord,1)
if waitDelay > elapse then
tinsert(waitTable,i,{waitDelay-elapse,waitFunc,waitParams})
i = i + 1
else
count = count - 1
func(unpack(params))
count = count - 1
waitFunc(unpack(waitParams))
end
end
end)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment