Software /
code /
prosody
Comparison
util/events.lua @ 6777:5de6b93d0190
util.*: Remove use of module() function, make all module functions local and return them in a table at the end
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 21 Feb 2015 10:36:37 +0100 |
parent | 6665:e923d7cb8430 |
child | 7039:138241cc1b3a |
comparison
equal
deleted
inserted
replaced
6774:3965662ae091 | 6777:5de6b93d0190 |
---|---|
12 local t_remove = table.remove; | 12 local t_remove = table.remove; |
13 local t_sort = table.sort; | 13 local t_sort = table.sort; |
14 local setmetatable = setmetatable; | 14 local setmetatable = setmetatable; |
15 local next = next; | 15 local next = next; |
16 | 16 |
17 module "events" | 17 local _ENV = nil; |
18 | 18 |
19 function new() | 19 local function new() |
20 local handlers = {}; | 20 local handlers = {}; |
21 local global_wrappers; | 21 local global_wrappers; |
22 local wrappers = {}; | 22 local wrappers = {}; |
23 local event_map = {}; | 23 local event_map = {}; |
24 local function _rebuild_index(handlers, event) | 24 local function _rebuild_index(handlers, event) |
149 _handlers = handlers; | 149 _handlers = handlers; |
150 _event_map = event_map; | 150 _event_map = event_map; |
151 }; | 151 }; |
152 end | 152 end |
153 | 153 |
154 return _M; | 154 return { |
155 new = new; | |
156 }; |