Convert Lua file object to C FILE *

I am creating a wrapper using LuaJIT and FFI. I have a C library with a function that takes a FILE* parameter as a parameter. In the Lua function in which I open the file using io.open() . Is there a way to dump, convert, or extract a file from a Lua object in C FILE* ? It seems to be simple, but I cannot find a solution. Thanks in advance.

+4
source share
1 answer

The LuaJIT chapter automatically converts the Lua file descriptor to FILE * (well, void *).

http://www.freelists.org/post/luajit/an-admittedly-lazy-programmer-question,4

+3
source

Source: https://habr.com/ru/post/1401259/


All Articles