diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-12-17 14:46:37 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-12-17 14:46:37 -0200 |
commit | 063d4e4543088e7a21965bda8ee5a0f952a9029e (patch) | |
tree | 6c3f2f8e98c26f071a94a32f9f2754396a66a9de /liolib.c | |
parent | e354c6355e7f48e087678ec49e340ca0696725b1 (diff) | |
download | lua-5.3.5.tar.gz lua-5.3.5.tar.bz2 lua-5.3.5.zip |
Lua 5.3.5 ported to gitv5.3.5
This is the first commit for the branch Lua 5.3. All source files
were copied from the official distribution of 5.3.5 in the Lua site.
The test files are the same of 5.3.4. The manual came from the
previous RCS repository, revision 1.167.1.2.
Diffstat (limited to '')
-rw-r--r-- | liolib.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 2.150 2016/09/01 16:14:56 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.151.1.1 2017/04/19 17:29:57 roberto Exp $ |
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 | */ |
@@ -206,11 +206,16 @@ static int aux_close (lua_State *L) { | |||
206 | } | 206 | } |
207 | 207 | ||
208 | 208 | ||
209 | static int f_close (lua_State *L) { | ||
210 | tofile(L); /* make sure argument is an open stream */ | ||
211 | return aux_close(L); | ||
212 | } | ||
213 | |||
214 | |||
209 | static int io_close (lua_State *L) { | 215 | static int io_close (lua_State *L) { |
210 | if (lua_isnone(L, 1)) /* no argument? */ | 216 | if (lua_isnone(L, 1)) /* no argument? */ |
211 | lua_getfield(L, LUA_REGISTRYINDEX, IO_OUTPUT); /* use standard output */ | 217 | lua_getfield(L, LUA_REGISTRYINDEX, IO_OUTPUT); /* use standard output */ |
212 | tofile(L); /* make sure argument is an open stream */ | 218 | return f_close(L); |
213 | return aux_close(L); | ||
214 | } | 219 | } |
215 | 220 | ||
216 | 221 | ||
@@ -712,7 +717,7 @@ static const luaL_Reg iolib[] = { | |||
712 | ** methods for file handles | 717 | ** methods for file handles |
713 | */ | 718 | */ |
714 | static const luaL_Reg flib[] = { | 719 | static const luaL_Reg flib[] = { |
715 | {"close", io_close}, | 720 | {"close", f_close}, |
716 | {"flush", f_flush}, | 721 | {"flush", f_flush}, |
717 | {"lines", f_lines}, | 722 | {"lines", f_lines}, |
718 | {"read", f_read}, | 723 | {"read", f_read}, |