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 ...@@ -285,7 +285,7 @@ end
local waitTable = {} local waitTable = {}
local waitFrame local waitFrame
function E:Delay(delay, func, ...) 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 return false
end end
local extend = {...} local extend = {...}
...@@ -293,22 +293,22 @@ function E:Delay(delay, func, ...) ...@@ -293,22 +293,22 @@ function E:Delay(delay, func, ...)
C_Timer_After(delay, func) C_Timer_After(delay, func)
return true return true
else else
if(waitFrame == nil) then if waitFrame == nil then
waitFrame = CreateFrame("Frame","WaitFrame", E.UIParent) waitFrame = CreateFrame("Frame","WaitFrame", E.UIParent)
waitFrame:SetScript("onUpdate",function (_,elapse) waitFrame:SetScript("onUpdate",function (_,elapse)
local count = #waitTable local waitRecord, waitDelay, waitFunc, waitParams
local i = 1 local i, count = 1, #waitTable
while(i<=count) do while i <= count do
local waitRecord = tremove(waitTable,i) waitRecord = tremove(waitTable,i)
local delay = tremove(waitRecord,1) waitDelay = tremove(waitRecord,1)
local func = tremove(waitRecord,1) waitFunc = tremove(waitRecord,1)
local params = tremove(waitRecord,1) waitParams = tremove(waitRecord,1)
if(delay>elapse) then if waitDelay > elapse then
tinsert(waitTable,i,{delay-elapse,func,params}) tinsert(waitTable,i,{waitDelay-elapse,waitFunc,waitParams})
i = i + 1 i = i + 1
else else
count = count - 1 count = count - 1
func(unpack(params)) waitFunc(unpack(waitParams))
end end
end 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