lua-users home
lua-l archive

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


I've got some code which wraps some internal objects with a FILE* handle
using fopencookie (Linux) and funopen (BSD, including OS X). These routines
allow specifying user callbacks (read, write, seek, and close) for FILE
operations.

Generating a LUA_FILEHANDLE userdata is relatively easy for Lua 5.1 and 5.2.
However, LuaJIT seems to tag it's LUA_FILEHANDLE with an internal type that
can't be faked.

Has anybody gotten around this? The only idea I can think of is to create a
LUA_FILEHANDLE to /dev/null, then swapping out the FILE* member. Any others?