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