diff options
-rw-r--r-- | lauxlib.h | 27 | ||||
-rw-r--r-- | liolib.c | 8 |
2 files changed, 28 insertions, 7 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.h,v 1.116 2011/04/08 19:17:36 roberto Exp roberto $ | 2 | ** $Id: lauxlib.h,v 1.117 2011/06/16 14:10:12 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -163,6 +163,31 @@ LUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz); | |||
163 | /* }====================================================== */ | 163 | /* }====================================================== */ |
164 | 164 | ||
165 | 165 | ||
166 | |||
167 | /* | ||
168 | ** {====================================================== | ||
169 | ** File handles for IO library | ||
170 | ** ======================================================= | ||
171 | */ | ||
172 | |||
173 | /* | ||
174 | ** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and | ||
175 | ** initial structure 'luaIO_Stream' (it may contain other fields | ||
176 | ** after that initial structure). | ||
177 | */ | ||
178 | |||
179 | #define LUA_FILEHANDLE "FILE*" | ||
180 | |||
181 | |||
182 | typedef struct luaIO_Stream { | ||
183 | FILE *f; /* stream (NULL for incompletely created streams) */ | ||
184 | lua_CFunction closef; /* to close stream (NULL for closed streams) */ | ||
185 | } luaIO_Stream; | ||
186 | |||
187 | /* }====================================================== */ | ||
188 | |||
189 | |||
190 | |||
166 | /* compatibility with old module system */ | 191 | /* compatibility with old module system */ |
167 | #if defined(LUA_COMPAT_MODULE) | 192 | #if defined(LUA_COMPAT_MODULE) |
168 | 193 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 2.104 2011/09/13 21:09:04 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.105 2011/11/09 14:10:43 roberto Exp roberto $ |
3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -102,11 +102,7 @@ | |||
102 | #define IO_OUTPUT (IO_PREFIX "output") | 102 | #define IO_OUTPUT (IO_PREFIX "output") |
103 | 103 | ||
104 | 104 | ||
105 | typedef struct LStream { | 105 | typedef luaIO_Stream LStream; |
106 | FILE *f; /* stream */ | ||
107 | lua_CFunction closef; /* to close stream (NULL for closed streams) */ | ||
108 | } LStream; | ||
109 | |||
110 | 106 | ||
111 | 107 | ||
112 | #define tolstream(L) ((LStream *)luaL_checkudata(L, 1, LUA_FILEHANDLE)) | 108 | #define tolstream(L) ((LStream *)luaL_checkudata(L, 1, LUA_FILEHANDLE)) |