lua-users home
lua-l archive

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


> 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.

If your facade program does not need Lua then you can use lstrip.c with
few changes. If the facade program needs Lua, then you're out of luck with
reusing lstrip.c because it defines its own luaY_parser function, which will
shadow the one in the Lua 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).

Just change the "strip" function in lstrip.c to be your external entry point
and call luaL_loadstring instead of luaL_loadfile. In dodump, change printf
to whatever you need to get the strings. Or change the calls to printf to
something else, if you need line,token,value as 3 separate things.

If you need further help, please contact me off list.
--lhf