aboutsummaryrefslogtreecommitdiff
path: root/src/mime.lua
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-05-28 06:16:43 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-05-28 06:16:43 +0000
commit694edcc3c1ac3041ff8cdd753a2f7894e8783e6c (patch)
treef8797b4c7671fbf9042fc011277d69d4c3549045 /src/mime.lua
parentbf738a03368b8de9c574d9631f131c5a520acf7b (diff)
downloadluasocket-694edcc3c1ac3041ff8cdd753a2f7894e8783e6c.tar.gz
luasocket-694edcc3c1ac3041ff8cdd753a2f7894e8783e6c.tar.bz2
luasocket-694edcc3c1ac3041ff8cdd753a2f7894e8783e6c.zip
Committing with require.
Diffstat (limited to 'src/mime.lua')
-rw-r--r--src/mime.lua27
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 @@
1if not ltn12 then error('Requires LTN12 module') end 1-----------------------------------------------------------------------------
2-- create mime namespace 2-- MIME support for the Lua language.
3mime = 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-----------------------------------------------------------------------------
12open, err1, err2 = loadlib("mime", "luaopen_mime")
13if not open then error(err1) end
14open()
15if not MIME_LIBNAME then error("MIME init failed") end
16
17-----------------------------------------------------------------------------
18-- Namespace independence
19-----------------------------------------------------------------------------
20local mime = _G[MIME_LIBNAME]
21if not mime then error('MIME init FAILED') end
22
23require("ltn12")
24
4-- make all module globals fall into mime namespace 25-- make all module globals fall into mime namespace
5setmetatable(mime, { __index = _G }) 26setmetatable(mime, { __index = _G })
6setfenv(1, mime) 27setfenv(1, mime)