Almost ready for beta3

This commit is contained in:
Diego Nehab
2004-11-27 07:58:04 +00:00
parent eb0fc857dd
commit 7c97e8e40a
26 changed files with 310 additions and 190 deletions

View File

@ -8,9 +8,10 @@
-----------------------------------------------------------------------------
-- Declare module and import dependencies
-----------------------------------------------------------------------------
module("mime")
local mime = require("lmime")
local base = require("base")
local ltn12 = require("ltn12")
local mime = require("lmime")
module("mime")
-- encode, decode and wrap algorithm tables
mime.encodet = {}
@ -20,11 +21,11 @@ mime.wrapt = {}
-- creates a function that chooses a filter by name from a given table
local function choose(table)
return function(name, opt1, opt2)
if type(name) ~= "string" then
if base.type(name) ~= "string" then
name, opt1, opt2 = "default", name, opt1
end
local f = table[name or "nil"]
if not f then error("unknown key (" .. tostring(name) .. ")", 3)
if not f then error("unknown key (" .. base.tostring(name) .. ")", 3)
else return f(opt1, opt2) end
end
end
@ -74,3 +75,5 @@ end
function mime.stuff()
return ltn12.filter.cycle(dot, 2)
end
base.setmetatable(mime, nil)