diff options
author | Lua Team <team@lua.org> | 2011-11-24 12:00:00 +0000 |
---|---|---|
committer | repogen <> | 2011-11-24 12:00:00 +0000 |
commit | 2e5ae8240bb2daf5d66d69e199de10dde62f5d13 (patch) | |
tree | b9f21bdd5006c59adc99000afa3cf22da8ea1c57 /src/lauxlib.h | |
parent | c17c598e967843fa77a465caf0e0df15d9019409 (diff) | |
download | lua-github-5.2.0-rc1.tar.gz |
Lua 5.2.0-rc15.2.0-rc1
Diffstat (limited to 'src/lauxlib.h')
-rw-r--r-- | src/lauxlib.h | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/lauxlib.h b/src/lauxlib.h index a7aa0d76..48b1afa0 100644 --- a/src/lauxlib.h +++ b/src/lauxlib.h @@ -1,5 +1,5 @@ /* -** $Id: lauxlib.h,v 1.117 2011/06/16 14:10:12 roberto Exp $ +** $Id: lauxlib.h,v 1.119 2011/11/14 17:10:24 roberto Exp $ ** 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); @@ -163,6 +167,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 'luaL_Stream' (it may contain other fields +** after that initial structure). +*/ + +#define LUA_FILEHANDLE "FILE*" + + +typedef struct luaL_Stream { + FILE *f; /* stream (NULL for incompletely created streams) */ + lua_CFunction closef; /* to close stream (NULL for closed streams) */ +} luaL_Stream; + +/* }====================================================== */ + + + /* compatibility with old module system */ #if defined(LUA_COMPAT_MODULE) |