diff --git a/src/poller.lua b/src/poller.lua index 8945878..cd629a7 100644 --- a/src/poller.lua +++ b/src/poller.lua @@ -83,14 +83,14 @@ function poller_mt:stop() self.is_running = false end -module(...) +local M = {} -function new(pre_alloc) +function M.new(pre_alloc) return setmetatable({ poller = zmq.ZMQ_Poller(pre_alloc), callbacks = {}, }, poller_mt) end -setmetatable(_M, {__call = function(tab, ...) return new(...) end}) +return setmetatable(M, {__call = function(tab, ...) return M.new(...) end}) diff --git a/src/threads.lua b/src/threads.lua index 99257ea..4f6b981 100644 --- a/src/threads.lua +++ b/src/threads.lua @@ -85,26 +85,27 @@ local function new_thread(ctx, action, action_arg, ...) }, thread_mt) end -module(...) +local M = {} -function set_bootstrap_prelude(code) +function M.set_bootstrap_prelude(code) bootstrap_code = bootstrap_pre .. code .. bootstrap_post end -function runfile(ctx, file, ...) +function M.runfile(ctx, file, ...) return new_thread(ctx, 'runfile', file, ...) end -function runstring(ctx, code, ...) +function M.runstring(ctx, code, ...) return new_thread(ctx, 'runstring', code, ...) end local parent_ctx = nil -function set_parent_ctx(ctx) +function M.set_parent_ctx(ctx) parent_ctx = ctx end -function get_parent_ctx(ctx) +function M.get_parent_ctx(ctx) return parent_ctx end +return M