aboutsummaryrefslogtreecommitdiff
path: root/src/mime.lua
diff options
context:
space:
mode:
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)