diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-06-26 08:52:26 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-06-26 08:52:26 +0500 |
commit | d9a71da2205b437903f52f517e3c6bc72eebd59a (patch) | |
tree | 55049ca87e6b6f5ba4dc619fca8c382ff34d6230 /util | |
parent | 1ce4a34f68ef4ce967533a35299e205f2321f12b (diff) | |
download | prosody-d9a71da2205b437903f52f517e3c6bc72eebd59a.tar.gz prosody-d9a71da2205b437903f52f517e3c6bc72eebd59a.zip |
util.events: Replaced ipairs with slightly faster numeric for loop - #optimization
Diffstat (limited to 'util')
-rw-r--r-- | util/events.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/util/events.lua b/util/events.lua index 3816f30b..6d69c95d 100644 --- a/util/events.lua +++ b/util/events.lua @@ -53,8 +53,8 @@ function new() local h = handlers[event];
if not h then h = {}; handlers[event] = h; end
local dispatcher = function(...)
- for _, handler in ipairs(h) do
- local ret = handler(...);
+ for i=1,#h do
+ local ret = h[i](...);
if ret ~= nil then return ret; end
end
end;
@@ -67,8 +67,8 @@ function new() local function fire_event(event, ...) -- FIXME duplicates dispatcher code
local h = handlers[event];
if h then
- for _, handler in ipairs(h) do
- local ret = handler(...);
+ for i=1,#h do
+ local ret = h[i](...);
if ret ~= nil then return ret; end
end
end
|