lua-users home
lua-l archive

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


I would like to use from C the FILE* of a file opened by openfile() in 
Lua 4.0a:

h = openfile("file1", "rb")

I tried (FILE *) lua_getuserdata(lua_getparam(1)) to get the FILE* but 
it doesn't work.
I had a look at liolib.c but I did't understand exactly what I should 
do. It seem that the standard Lua I/O function uses an additional 
parameter (for examples, io_flush() seem to need 2 parameters). 
Moreover, all liolib.c struct and functions are static and I guess that 
nobody else should call them directly.
I prefer to use C's fget()/fput() instead of Lua's read()/write() in 
Could anybody tell me how can I do ?


Some suggestions about Lua:
- lauxlib.c: Adds also luaL_check_userdata() and luaL_opt_userdata().
- lauxlib.c: Renames luaL_table/function/nonnullarg() in 
- lauxlib.c: Adds luaL_opt_table/function().
- liolib.c: Calls closefile() with a variable number of filehandles, 
not just only 1.
- Lua-l: Adds another small lua-l-archive.gz archive with only last 
emails (for example, last 500/1000 or last year/half-year emails).