diff options
-rw-r--r-- | liolib.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 2.119 2014/03/13 20:07:18 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.120 2014/03/19 18:57:42 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 | */ |
@@ -455,9 +455,9 @@ static int g_read (lua_State *L, FILE *f, int first) { | |||
455 | success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l); | 455 | success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l); |
456 | } | 456 | } |
457 | else { | 457 | else { |
458 | const char *p = lua_tostring(L, n); | 458 | const char *p = luaL_checkstring(L, n); |
459 | luaL_argcheck(L, p && p[0] == '*', n, "invalid option"); | 459 | if (*p == '*') p++; /* skip optional '*' (for compatibility) */ |
460 | switch (p[1]) { | 460 | switch (*p) { |
461 | case 'i': /* integer */ | 461 | case 'i': /* integer */ |
462 | success = read_integer(L, f); | 462 | success = read_integer(L, f); |
463 | break; | 463 | break; |