|
|
@ -1,5 +1,5 @@ |
|
|
|
--[[ |
|
|
|
--[[ |
|
|
|
* Ashita - Copyright (c) 2014 - 2016 atom0s [atom0s@live.com] |
|
|
|
* Ashita - Copyright (c) 2014 - 2017 atom0s [atom0s@live.com] |
|
|
|
* |
|
|
|
* |
|
|
|
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. |
|
|
|
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. |
|
|
|
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to |
|
|
|
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to |
|
|
@ -74,7 +74,7 @@ local function once(delay, func, ...) |
|
|
|
if (func) then |
|
|
|
if (func) then |
|
|
|
t.Function = func; |
|
|
|
t.Function = func; |
|
|
|
end |
|
|
|
end |
|
|
|
f.Args = {...}; |
|
|
|
t.Args = {...}; |
|
|
|
|
|
|
|
|
|
|
|
table.insert(ashita.timer.timersonce, t); |
|
|
|
table.insert(ashita.timer.timersonce, t); |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -190,7 +190,7 @@ local function pulse(name) |
|
|
|
-- Handle the normal timers.. |
|
|
|
-- Handle the normal timers.. |
|
|
|
for k, v in pairs(ashita.timer.timers) do |
|
|
|
for k, v in pairs(ashita.timer.timers) do |
|
|
|
if (v.Status == TIMER_PAUSED) then |
|
|
|
if (v.Status == TIMER_PAUSED) then |
|
|
|
v.Last = os.timer() - v.Diff; |
|
|
|
v.Last = os.time() - v.Diff; |
|
|
|
elseif (v.Status == TIMER_RUNNING and (v.Last + v.Delay) <= os.time()) then |
|
|
|
elseif (v.Status == TIMER_RUNNING and (v.Last + v.Delay) <= os.time()) then |
|
|
|
v.Last = os.time(); |
|
|
|
v.Last = os.time(); |
|
|
|
v.n = v.n + 1; |
|
|
|
v.n = v.n + 1; |
|
|
@ -210,14 +210,14 @@ local function pulse(name) |
|
|
|
|
|
|
|
|
|
|
|
-- Handle the once timers.. |
|
|
|
-- Handle the once timers.. |
|
|
|
for k, v in pairs(ashita.timer.timersonce) do |
|
|
|
for k, v in pairs(ashita.timer.timersonce) do |
|
|
|
if (v.Finish <= os.timer()) then |
|
|
|
if (v.Finish <= os.time()) then |
|
|
|
local a, b, c, d, e, f = pcall(v.Function, unpack(v.Args)); |
|
|
|
local a, b, c, d, e, f = pcall(v.Function, unpack(v.Args)); |
|
|
|
if (a == nil or a == false) then |
|
|
|
if (a == nil or a == false) then |
|
|
|
print(_addon.name .. ' - timer.lua pcall error: ' .. tostring(b)); |
|
|
|
print(_addon.name .. ' - timer.lua pcall error: ' .. tostring(b)); |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- Remove the timer.. |
|
|
|
-- Remove the timer.. |
|
|
|
ashita.timer.timersonce[name] = nil; |
|
|
|
ashita.timer.timersonce[k] = nil; |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|