lua-users home
lua-l archive

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


On Sun, Mar 27, 2011 at 6:11 AM, Mike Pall <mikelu-1103@mike.de> wrote:
>
> It looks like luaposix copies the internal metatable for files and
> attaches it to their own userdata object. This doesn't work with
> LuaJIT. luaposix shouldn't access internals of the VM in this way.


that's unfortunate.  i've had to do similar things sometimes, since
there's no clean way to get to the FILE* from the file object.  the
alternative is not to accept Lua file objects for any C extension that
uses files.

I guess the best would be to export the tofile() function in liolib.c
(i'm reading some old sources here, maybe could be there for Lua 5.2?)


> But with LuaJIT there's no need to use luaposix. You can directly
> access all POSIX C library functions with the FFI library.

...except for compatibility


--
Javier