diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-05-28 07:47:41 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-05-28 07:47:41 +0000 |
commit | 6c565dd7c06c96fd9b3394ade61f46da59590d30 (patch) | |
tree | f303c1a94627e002fa4dd73d2f2641596b8b1420 /src | |
parent | 84f03fda7c2be57e14f937e295710b5e883fedc6 (diff) | |
download | luasocket-6c565dd7c06c96fd9b3394ade61f46da59590d30.tar.gz luasocket-6c565dd7c06c96fd9b3394ade61f46da59590d30.tar.bz2 luasocket-6c565dd7c06c96fd9b3394ade61f46da59590d30.zip |
Almost there.
Diffstat (limited to 'src')
-rw-r--r-- | src/ftp.lua | 3 | ||||
-rw-r--r-- | src/http.lua | 3 | ||||
-rw-r--r-- | src/smtp.lua | 6 | ||||
-rw-r--r-- | src/url.lua | 6 |
4 files changed, 8 insertions, 10 deletions
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 @@ | |||
6 | -- RCS ID: $Id$ | 6 | -- RCS ID: $Id$ |
7 | ----------------------------------------------------------------------------- | 7 | ----------------------------------------------------------------------------- |
8 | -- make sure LuaSocket is loaded | 8 | -- make sure LuaSocket is loaded |
9 | if not LUASOCKET_LIBNAME then error('module requires LuaSocket') end | 9 | require("luasocket") |
10 | -- get LuaSocket namespace | 10 | -- get LuaSocket namespace |
11 | local socket = _G[LUASOCKET_LIBNAME] | 11 | local socket = _G[LUASOCKET_LIBNAME] |
12 | if not socket then error('module requires LuaSocket') end | ||
13 | 12 | ||
14 | -- require other modules | 13 | -- require other modules |
15 | require("ltn12") | 14 | 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 @@ | |||
6 | -- RCS ID: $Id$ | 6 | -- RCS ID: $Id$ |
7 | ----------------------------------------------------------------------------- | 7 | ----------------------------------------------------------------------------- |
8 | -- make sure LuaSocket is loaded | 8 | -- make sure LuaSocket is loaded |
9 | if not LUASOCKET_LIBNAME then error('module requires LuaSocket') end | 9 | require("luasocket") |
10 | -- get LuaSocket namespace | 10 | -- get LuaSocket namespace |
11 | local socket = _G[LUASOCKET_LIBNAME] | 11 | local socket = _G[LUASOCKET_LIBNAME] |
12 | if not socket then error('module requires LuaSocket') end | ||
13 | 12 | ||
14 | -- require other modules | 13 | -- require other modules |
15 | require("ltn12") | 14 | 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 @@ | |||
6 | -- RCS ID: $Id$ | 6 | -- RCS ID: $Id$ |
7 | ----------------------------------------------------------------------------- | 7 | ----------------------------------------------------------------------------- |
8 | -- make sure LuaSocket is loaded | 8 | -- make sure LuaSocket is loaded |
9 | if not LUASOCKET_LIBNAME then error('module requires LuaSocket') end | 9 | require"luasocket" |
10 | -- get LuaSocket namespace | 10 | -- get LuaSocket namespace |
11 | local socket = _G[LUASOCKET_LIBNAME] | 11 | local socket = _G[LUASOCKET_LIBNAME] |
12 | if not socket then error('module requires LuaSocket') end | 12 | |
13 | require"ltn12" | ||
13 | 14 | ||
14 | -- create smtp namespace inside LuaSocket namespace | 15 | -- create smtp namespace inside LuaSocket namespace |
15 | local smtp = socket.smtp or {} | 16 | local smtp = socket.smtp or {} |
@@ -18,6 +19,7 @@ socket.smtp = smtp | |||
18 | setmetatable(smtp, { __index = _G }) | 19 | setmetatable(smtp, { __index = _G }) |
19 | setfenv(1, smtp) | 20 | setfenv(1, smtp) |
20 | 21 | ||
22 | |||
21 | -- default server used to send e-mails | 23 | -- default server used to send e-mails |
22 | SERVER = "localhost" | 24 | SERVER = "localhost" |
23 | -- default port | 25 | -- 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 @@ | |||
5 | -- Conforming to: RFC 2396, LTN7 | 5 | -- Conforming to: RFC 2396, LTN7 |
6 | -- RCS ID: $Id$ | 6 | -- RCS ID: $Id$ |
7 | ---------------------------------------------------------------------------- | 7 | ---------------------------------------------------------------------------- |
8 | |||
9 | -- make sure LuaSocket is loaded | 8 | -- make sure LuaSocket is loaded |
10 | if not LUASOCKET_LIBNAME then error('module requires LuaSocket') end | 9 | require"luasocket" |
11 | -- get LuaSocket namespace | 10 | -- get LuaSocket namespace |
12 | local socket = _G[LUASOCKET_LIBNAME] | 11 | local socket = _G[LUASOCKET_LIBNAME] |
13 | if not socket then error('module requires LuaSocket') end | 12 | -- create url namespace inside LuaSocket namespace |
14 | -- create smtp namespace inside LuaSocket namespace | ||
15 | local url = socket.url or {} | 13 | local url = socket.url or {} |
16 | socket.url = url | 14 | socket.url = url |
17 | -- make all module globals fall into smtp namespace | 15 | -- make all module globals fall into smtp namespace |