new function 'luaL_loadfilex'

This commit is contained in:
Roberto Ierusalimschy
2011-11-14 15:10:24 -02:00
parent eb70f58279
commit 6cce5c0601
3 changed files with 50 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lauxlib.h,v 1.117 2011/06/16 14:10:12 roberto Exp roberto $
** $Id: lauxlib.h,v 1.118 2011/11/11 19:59:17 roberto Exp roberto $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@@ -72,7 +72,11 @@ LUALIB_API int (luaL_execresult) (lua_State *L, int stat);
LUALIB_API int (luaL_ref) (lua_State *L, int t);
LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename);
LUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename,
const char *mode);
#define luaL_loadfile(L,f) luaL_loadfilex(L,f,NULL)
LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz,
const char *name);
LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);
@@ -172,17 +176,17 @@ LUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz);
/*
** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and
** initial structure 'luaIO_Stream' (it may contain other fields
** initial structure 'luaL_Stream' (it may contain other fields
** after that initial structure).
*/
#define LUA_FILEHANDLE "FILE*"
typedef struct luaIO_Stream {
typedef struct luaL_Stream {
FILE *f; /* stream (NULL for incompletely created streams) */
lua_CFunction closef; /* to close stream (NULL for closed streams) */
} luaIO_Stream;
} luaL_Stream;
/* }====================================================== */