api: avoid garbage table creation on QueueFunction

This commit is contained in:
Road-block
2018-05-25 19:38:47 +03:00
committed by Shagu
parent 64bf5d15e6
commit 3f8a70f725
+2 -7
View File
@@ -339,13 +339,8 @@ function pfUI.api.QueueFunction(...)
end)
end
assert(type(arg[1])=="function","QueueFunction: arg1 is not a function")
local func = arg[1]
local args
for i=2,arg.n do
args = args or {}
table.insert(args,arg[i])
end
table.insert(timer.queue,{func,args})
local func = table.remove(arg, 1)
table.insert(timer.queue,{func,arg})
timer:Show() -- start the OnUpdate
end