From 6c565dd7c06c96fd9b3394ade61f46da59590d30 Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Fri, 28 May 2004 07:47:41 +0000 Subject: Almost there. --- src/ftp.lua | 3 +-- src/http.lua | 3 +-- src/smtp.lua | 6 ++++-- src/url.lua | 6 ++---- 4 files changed, 8 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/ftp.lua b/src/ftp.lua index efb872a..f197018 100644 --- a/src/ftp.lua +++ b/src/ftp.lua @@ -6,10 +6,9 @@ -- RCS ID: $Id$ ----------------------------------------------------------------------------- -- make sure LuaSocket is loaded -if not LUASOCKET_LIBNAME then error('module requires LuaSocket') end +require("luasocket") -- get LuaSocket namespace local socket = _G[LUASOCKET_LIBNAME] -if not socket then error('module requires LuaSocket') end -- require other modules require("ltn12") diff --git a/src/http.lua b/src/http.lua index e6a0928..7dee8e6 100644 --- a/src/http.lua +++ b/src/http.lua @@ -6,10 +6,9 @@ -- RCS ID: $Id$ ----------------------------------------------------------------------------- -- make sure LuaSocket is loaded -if not LUASOCKET_LIBNAME then error('module requires LuaSocket') end +require("luasocket") -- get LuaSocket namespace local socket = _G[LUASOCKET_LIBNAME] -if not socket then error('module requires LuaSocket') end -- require other modules require("ltn12") diff --git a/src/smtp.lua b/src/smtp.lua index 1d1905e..8b5e622 100644 --- a/src/smtp.lua +++ b/src/smtp.lua @@ -6,10 +6,11 @@ -- RCS ID: $Id$ ----------------------------------------------------------------------------- -- make sure LuaSocket is loaded -if not LUASOCKET_LIBNAME then error('module requires LuaSocket') end +require"luasocket" -- get LuaSocket namespace local socket = _G[LUASOCKET_LIBNAME] -if not socket then error('module requires LuaSocket') end + +require"ltn12" -- create smtp namespace inside LuaSocket namespace local smtp = socket.smtp or {} @@ -18,6 +19,7 @@ socket.smtp = smtp setmetatable(smtp, { __index = _G }) setfenv(1, smtp) + -- default server used to send e-mails SERVER = "localhost" -- default port diff --git a/src/url.lua b/src/url.lua index 0fba14d..b385d88 100644 --- a/src/url.lua +++ b/src/url.lua @@ -5,13 +5,11 @@ -- Conforming to: RFC 2396, LTN7 -- RCS ID: $Id$ ---------------------------------------------------------------------------- - -- make sure LuaSocket is loaded -if not LUASOCKET_LIBNAME then error('module requires LuaSocket') end +require"luasocket" -- get LuaSocket namespace local socket = _G[LUASOCKET_LIBNAME] -if not socket then error('module requires LuaSocket') end --- create smtp namespace inside LuaSocket namespace +-- create url namespace inside LuaSocket namespace local url = socket.url or {} socket.url = url -- make all module globals fall into smtp namespace -- cgit v1.2.3-55-g6feb