strutcture for file handles exported in 'lauxlib.h'

This commit is contained in:
Roberto Ierusalimschy
2011-11-11 17:59:17 -02:00
parent 3105febf9a
commit ef900f224c
2 changed files with 28 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lauxlib.h,v 1.116 2011/04/08 19:17:36 roberto Exp roberto $
** $Id: lauxlib.h,v 1.117 2011/06/16 14:10:12 roberto Exp roberto $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@@ -163,6 +163,31 @@ LUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz);
/* }====================================================== */
/*
** {======================================================
** File handles for IO library
** =======================================================
*/
/*
** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and
** initial structure 'luaIO_Stream' (it may contain other fields
** after that initial structure).
*/
#define LUA_FILEHANDLE "FILE*"
typedef struct luaIO_Stream {
FILE *f; /* stream (NULL for incompletely created streams) */
lua_CFunction closef; /* to close stream (NULL for closed streams) */
} luaIO_Stream;
/* }====================================================== */
/* compatibility with old module system */
#if defined(LUA_COMPAT_MODULE)