[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: How shall a Lua file handle be known?
- From: Sam Roberts <vieuxtech@...>
- Date: Wed, 11 May 2011 19:53:30 -0700
On Wed, May 11, 2011 at 1:34 PM, Reuben Thomas <firstname.lastname@example.org> wrote:
> (I'm not so interested as to whether the technique works, it clearly
> does, as whether it's considered an abuse of the API.)
The fact that io's userdata is a FILE** is clearly not part of the io
libraries public API, this
FILE *f = *(FILE**) luaL_checkudata(L, 1, LUA_FILEHANDLE);
is clearly deeply reliant on its internal data structure.
As Mike says:
> I do not see an easy and portable way to inherit the standard io.*
methods, unless there's an explicit API function that provides
Knowing that you aren't the only developer forced to depend on lua
internals might help convince the lua authors to provide such an API.