scsi:t-0x00 $ ˆl–äY>”ªe¶… @;pÜ Å£Â „ZyŸÁÀ¿ ,Û
The ltn12 namespace implements the ideas described in LTN012, Filters sources and sinks. This manual simply describes the functions. Please refer to the LTN for a deeper explanation of the functionality provided by this module.
To obtain the ltn12 namespace, run:
-- loads the LTN21 module
local ltn12 = require("ltn12")
ltn12.filter.chain(filter1, filter2 [, ... filterN])
Returns a filter that passes all data it receives through each of a series of given filters.
Filter1 to filterN are simple filters.
The function returns the chained filter.
The nesting of filters can be arbitrary. For instance, the useless filter below doesn't do anything but return the data that was passed to it, unaltered.
-- load required modules
local ltn12 = require("ltn12")
local mime = require("mime")
-- create a silly identity filter
id = ltn12.filter.chain(
mime.encode("quoted-printable"),
mime.encode("base64"),
mime.decode("base64"),
mime.decode("quoted-printable")
)
ltn12.filter.cycle(low [, ctx, extra])
Returns a high-level filter that cycles though a low-level filter by passing it each chunk and updating a context between calls.
Low is the low-level filter to be cycled, ctx is the initial context and extra is any extra argument the low-level filter might take.
The function returns the high-level filter.
-- load the ltn12 module
local ltn12 = require("ltn12")
-- the base64 mime filter factory
encodet['base64'] = function()
return ltn12.filter.cycle(b64, "")
end
ltn12.pump.all(source, sink)
Pumps all data from a source to a sink.
If successful, the function returns a value that evaluates to true. In case of error, the function returns a false value, f