diff options
| -rw-r--r-- | liolib.c | 6 |
1 files changed, 4 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: liolib.c,v 2.61 2005/05/25 13:21:26 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.62 2005/06/06 13:30:52 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 | */ |
| @@ -442,7 +442,9 @@ static int f_setvbuf (lua_State *L) { | |||
| 442 | static const char *const modenames[] = {"no", "full", "line", NULL}; | 442 | static const char *const modenames[] = {"no", "full", "line", NULL}; |
| 443 | FILE *f = tofile(L); | 443 | FILE *f = tofile(L); |
| 444 | int op = luaL_checkoption(L, 2, NULL, modenames); | 444 | int op = luaL_checkoption(L, 2, NULL, modenames); |
| 445 | return pushresult(L, setvbuf(f, NULL, mode[op], 0) == 0, NULL); | 445 | lua_Integer sz = luaL_optinteger(L, 3, BUFSIZ); |
| 446 | int res = setvbuf(f, NULL, mode[op], sz); | ||
| 447 | return pushresult(L, res == 0, NULL); | ||
| 446 | } | 448 | } |
| 447 | 449 | ||
| 448 | 450 | ||
