diff options
| -rw-r--r-- | lbaselib.c | 5 |
1 files changed, 2 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbaselib.c,v 1.271 2011/11/29 15:55:08 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.272 2011/11/30 12:42:21 roberto Exp roberto $ |
| 3 | ** Basic library | 3 | ** Basic library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -288,7 +288,6 @@ static int luaB_loadfile (lua_State *L) { | |||
| 288 | ** reserved slot inside the stack. | 288 | ** reserved slot inside the stack. |
| 289 | */ | 289 | */ |
| 290 | static const char *generic_reader (lua_State *L, void *ud, size_t *size) { | 290 | static const char *generic_reader (lua_State *L, void *ud, size_t *size) { |
| 291 | const char *s; | ||
| 292 | (void)(ud); /* not used */ | 291 | (void)(ud); /* not used */ |
| 293 | luaL_checkstack(L, 2, "too many nested functions"); | 292 | luaL_checkstack(L, 2, "too many nested functions"); |
| 294 | lua_pushvalue(L, 1); /* get function */ | 293 | lua_pushvalue(L, 1); /* get function */ |
| @@ -297,7 +296,7 @@ static const char *generic_reader (lua_State *L, void *ud, size_t *size) { | |||
| 297 | *size = 0; | 296 | *size = 0; |
| 298 | return NULL; | 297 | return NULL; |
| 299 | } | 298 | } |
| 300 | else if ((s = lua_tostring(L, -1)) == NULL) | 299 | else if (!lua_isstring(L, -1)) |
| 301 | luaL_error(L, "reader function must return a string"); | 300 | luaL_error(L, "reader function must return a string"); |
| 302 | lua_replace(L, RESERVEDSLOT); /* save string in reserved slot */ | 301 | lua_replace(L, RESERVEDSLOT); /* save string in reserved slot */ |
| 303 | return lua_tolstring(L, RESERVEDSLOT, size); | 302 | return lua_tolstring(L, RESERVEDSLOT, size); |
