diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-05-28 06:16:43 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-05-28 06:16:43 +0000 |
commit | 694edcc3c1ac3041ff8cdd753a2f7894e8783e6c (patch) | |
tree | f8797b4c7671fbf9042fc011277d69d4c3549045 /src/mime.lua | |
parent | bf738a03368b8de9c574d9631f131c5a520acf7b (diff) | |
download | luasocket-694edcc3c1ac3041ff8cdd753a2f7894e8783e6c.tar.gz luasocket-694edcc3c1ac3041ff8cdd753a2f7894e8783e6c.tar.bz2 luasocket-694edcc3c1ac3041ff8cdd753a2f7894e8783e6c.zip |
Committing with require.
Diffstat (limited to 'src/mime.lua')
-rw-r--r-- | src/mime.lua | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/mime.lua b/src/mime.lua index 37756c7..8f2cfff 100644 --- a/src/mime.lua +++ b/src/mime.lua | |||
@@ -1,6 +1,27 @@ | |||
1 | if not ltn12 then error('Requires LTN12 module') end | 1 | ----------------------------------------------------------------------------- |
2 | -- create mime namespace | 2 | -- MIME support for the Lua language. |
3 | mime = mime or {} | 3 | -- Author: Diego Nehab |
4 | -- Conforming to RFCs 2045-2049 | ||
5 | -- RCS ID: $Id$ | ||
6 | ----------------------------------------------------------------------------- | ||
7 | |||
8 | ----------------------------------------------------------------------------- | ||
9 | -- Load MIME from dynamic library | ||
10 | -- Comment these lines if you are loading static | ||
11 | ----------------------------------------------------------------------------- | ||
12 | open, err1, err2 = loadlib("mime", "luaopen_mime") | ||
13 | if not open then error(err1) end | ||
14 | open() | ||
15 | if not MIME_LIBNAME then error("MIME init failed") end | ||
16 | |||
17 | ----------------------------------------------------------------------------- | ||
18 | -- Namespace independence | ||
19 | ----------------------------------------------------------------------------- | ||
20 | local mime = _G[MIME_LIBNAME] | ||
21 | if not mime then error('MIME init FAILED') end | ||
22 | |||
23 | require("ltn12") | ||
24 | |||
4 | -- make all module globals fall into mime namespace | 25 | -- make all module globals fall into mime namespace |
5 | setmetatable(mime, { __index = _G }) | 26 | setmetatable(mime, { __index = _G }) |
6 | setfenv(1, mime) | 27 | setfenv(1, mime) |