mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-18 10:40:48 +00:00
api: replace varargs in function queue
Get rid of var-args as the handling of those changed alot during different api iterations. Therefore using static-args instead that can be handled the same way in all expansions.
This commit is contained in:
+6
-8
@@ -380,15 +380,15 @@ end
|
|||||||
-- Add functions to a FIFO queue for execution after a short delay.
|
-- Add functions to a FIFO queue for execution after a short delay.
|
||||||
-- '...' [vararg] function, [arguments]
|
-- '...' [vararg] function, [arguments]
|
||||||
local timer
|
local timer
|
||||||
function pfUI.api.QueueFunction(...)
|
function pfUI.api.QueueFunction(a1,a2,a3,a4,a5,a6,a7,a8,a9)
|
||||||
if not (timer) then
|
if not timer then
|
||||||
timer = CreateFrame("frame")
|
timer = CreateFrame("Frame")
|
||||||
timer.queue = {}
|
timer.queue = {}
|
||||||
timer.interval = TOOLTIP_UPDATE_TIME
|
timer.interval = TOOLTIP_UPDATE_TIME
|
||||||
timer.DeQueue = function()
|
timer.DeQueue = function()
|
||||||
local item = table.remove(timer.queue,1)
|
local item = table.remove(timer.queue,1)
|
||||||
if (item) then
|
if item then
|
||||||
item[1](unpack(item[2]))
|
item[1](item[2],item[3],item[4],item[5],item[6],item[7],item[8],item[9])
|
||||||
end
|
end
|
||||||
if table.getn(timer.queue) == 0 then
|
if table.getn(timer.queue) == 0 then
|
||||||
timer:Hide() -- no need to run the OnUpdate when the queue is empty
|
timer:Hide() -- no need to run the OnUpdate when the queue is empty
|
||||||
@@ -402,9 +402,7 @@ function pfUI.api.QueueFunction(...)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
assert(type(arg[1])=="function","QueueFunction: arg1 is not a function")
|
table.insert(timer.queue,{a1,a2,a3,a4,a5,a6,a7,a8,a9})
|
||||||
local func = table.remove(arg, 1)
|
|
||||||
table.insert(timer.queue,{func,arg})
|
|
||||||
timer:Show() -- start the OnUpdate
|
timer:Show() -- start the OnUpdate
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user