lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I've been reading about LTN12: http://w3.impa.br/~diego/software/luasocket/ltn12.html
it looks very useful, but I'm having trouble understanding just how it works.

Am I correct in that a filter is expected to accept a string, and return a (probably different) string? And a pump is just "read data from source and write it to sink"?

In toying around with this, I implemented a "tobase64" function. It takes a source and a sink, and keeps reading data from the source until no more is available, converting it to base64, and writing it to the sink. It seems like a simple enough system, able to process large amounts of data without using a lot of memory, and able to be chained (have the source or sink be another such function). But I think this isn't how filters normally work? What's the purpose of separating filter and pump?

--
Sent from my Game Boy.