aboutsummaryrefslogtreecommitdiff
path: root/liolib.c
diff options
context:
space:
mode:
Diffstat (limited to 'liolib.c')
-rw-r--r--liolib.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/liolib.c b/liolib.c
index e4851209..cb3325f0 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: liolib.c,v 1.100 2001/01/25 16:45:36 roberto Exp roberto $ 2** $Id: liolib.c,v 1.101 2001/01/26 11:45:51 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*/
@@ -306,14 +306,12 @@ static int io_read (lua_State *L) {
306 luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments"); 306 luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments");
307 success = 1; 307 success = 1;
308 for (n = 1; n<=nargs && success; n++) { 308 for (n = 1; n<=nargs && success; n++) {
309 const char *p = luaL_check_string(L, n); 309 if (lua_type(L, n) == LUA_TNUMBER)
310 if (p[0] != '*') { 310 success = read_chars(L, f, (size_t)lua_tonumber(L, n));
311 if (lua_isnumber(L, n))
312 success = read_chars(L, f, (size_t)lua_tonumber(L, n));
313 else
314 lua_error(L, "read patterns are deprecated");
315 }
316 else { 311 else {
312 const char *p = lua_tostring(L, n);
313 if (!p || p[0] != '*')
314 lua_error(L, "invalid `read' option");
317 switch (p[1]) { 315 switch (p[1]) {
318 case 'n': /* number */ 316 case 'n': /* number */
319 success = read_number(L, f); 317 success = read_number(L, f);