diff options
Diffstat (limited to 'liolib.c')
| -rw-r--r-- | liolib.c | 9 |
1 files changed, 8 insertions, 1 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: liolib.c,v 2.145 2015/06/21 13:50:29 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.146 2015/07/07 17:03:34 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 | */ |
| @@ -318,8 +318,15 @@ static int io_output (lua_State *L) { | |||
| 318 | static int io_readline (lua_State *L); | 318 | static int io_readline (lua_State *L); |
| 319 | 319 | ||
| 320 | 320 | ||
| 321 | /* | ||
| 322 | ** maximum number of arguments to 'f:lines'/'io.lines' (it + 3 must fit | ||
| 323 | ** in the limit for upvalues of a closure) | ||
| 324 | */ | ||
| 325 | #define MAXARGLINE 250 | ||
| 326 | |||
| 321 | static void aux_lines (lua_State *L, int toclose) { | 327 | static void aux_lines (lua_State *L, int toclose) { |
| 322 | int n = lua_gettop(L) - 1; /* number of arguments to read */ | 328 | int n = lua_gettop(L) - 1; /* number of arguments to read */ |
| 329 | luaL_argcheck(L, n <= MAXARGLINE, MAXARGLINE + 2, "too many arguments"); | ||
| 323 | lua_pushinteger(L, n); /* number of arguments to read */ | 330 | lua_pushinteger(L, n); /* number of arguments to read */ |
| 324 | lua_pushboolean(L, toclose); /* close/not close file when finished */ | 331 | lua_pushboolean(L, toclose); /* close/not close file when finished */ |
| 325 | lua_rotate(L, 2, 2); /* move 'n' and 'toclose' to their positions */ | 332 | lua_rotate(L, 2, 2); /* move 'n' and 'toclose' to their positions */ |
