lua-users home
lua-l archive

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


--- Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:

> > I have a project that needs the same functionality
> as lstrip -d,
> > except that the input and output need to be
> strings rather than a file
> > and stdout respectively.
> 
> If you mean from within Lua, and not as a standalone
> application, then
> the easiest way I think is to use a token filter in
> C that calls a Lua
> callback with whatever representation of each token
> you need. See below
> for an example.  

Thanks, but it doesn't particularly need to be within
Lua, and we'd MUCH rather not change Lua if we don't
have to. We have a facade program that needs this
functionality from Ruby, presumably via a C library.
The current code is almost exactly what we need except
that it uses file and printf I/O rather than C strings
(char* buffers).