diff options
author | Matthew Wild <mwild1@gmail.com> | 2011-11-03 12:47:52 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2011-11-03 12:47:52 +0000 |
commit | 011d76ac7652be0ca1b3e0c8b78975b2a8c66715 (patch) | |
tree | ac527b68a68c893422d6b883bd368e6322d28cab | |
parent | 69c88fc82812df77f372b9d1ceb9cf0dff3202e5 (diff) | |
download | prosody-011d76ac7652be0ca1b3e0c8b78975b2a8c66715.tar.gz prosody-011d76ac7652be0ca1b3e0c8b78975b2a8c66715.zip |
util.timer: Variable name change (func -> callback)
-rw-r--r-- | util/timer.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/util/timer.lua b/util/timer.lua index 642d6e36..d5b66473 100644 --- a/util/timer.lua +++ b/util/timer.lua @@ -26,15 +26,15 @@ module "timer" local _add_task; if not event then - function _add_task(delay, func) + function _add_task(delay, callback) local current_time = get_time(); delay = delay + current_time; if delay >= current_time then - t_insert(new_data, {delay, func}); + t_insert(new_data, {delay, callback}); else - local r = func(); + local r = callback(); if r and type(r) == "number" then - return _add_task(r, func); + return _add_task(r, callback); end end end @@ -50,12 +50,12 @@ if not event then local next_time = math_huge; for i, d in pairs(data) do - local t, func = d[1], d[2]; + local t, callback = d[1], d[2]; if t <= current_time then data[i] = nil; - local r = func(current_time); + local r = callback(current_time); if type(r) == "number" then - _add_task(r, func); + _add_task(r, callback); next_time = math_min(next_time, r); end else @@ -66,10 +66,10 @@ if not event then end); else local EVENT_LEAVE = (event.core and event.core.LEAVE) or -1; - function _add_task(delay, func) + function _add_task(delay, callback) local event_handle; event_handle = event_base:addevent(nil, 0, function () - local ret = func(); + local ret = callback(); if ret then return 0, ret; elseif event_handle then |