Don't pollute global _G space.

zmq3.0
Robert G. Jakabosky 15 years ago
parent c3dd0056e1
commit ffeb63cf7d

@ -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})

@ -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

Loading…
Cancel
Save