[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Problem using posix library pipe() from luajit2?
- From: Sam Roberts <vieuxtech@...>
- Date: Sun, 27 Mar 2011 13:09:50 -0700
On Sun, Mar 27, 2011 at 11:26 AM, Sean Conner <sean@conman.org> wrote:
> Perhaps I'm missing something, but I've done stuff like:
>
> Lua:
>
> f = io.open("/tmp/foo","r")
> x = blah(f)
>
> C:
>
> int blah(lua_State *L)
> {
> FILE **pfp;
>
> pfp = luaL_checkudata(L,1,LUA_FILEHANDLE);
> /* ... use *pfp to do fileish things */
> }
I've done the same, but on /dev.ttyS0, so I could then make tc calls
to set the terminal attributes.
Its not "official" but works fine with lua. Maybe lua and luajit can
coordinate to have a luaL_ api that returns the FILE*.
Sam