diff options
Diffstat (limited to 'lbaselib.c')
-rw-r--r-- | lbaselib.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.172 2005/03/22 16:04:29 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.173 2005/03/28 17:17:53 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 | */ |
@@ -294,11 +294,8 @@ static const char *generic_reader (lua_State *L, void *ud, size_t *size) { | |||
294 | return NULL; | 294 | return NULL; |
295 | } | 295 | } |
296 | else if (lua_isstring(L, -1)) { | 296 | else if (lua_isstring(L, -1)) { |
297 | const char *res; | ||
298 | lua_replace(L, 3); /* save string in a reserved stack slot */ | 297 | lua_replace(L, 3); /* save string in a reserved stack slot */ |
299 | res = lua_tostring(L, 3); | 298 | return lua_tolstring(L, 3, size); |
300 | *size = lua_strlen(L, 3); | ||
301 | return res; | ||
302 | } | 299 | } |
303 | else luaL_error(L, "reader function must return a string"); | 300 | else luaL_error(L, "reader function must return a string"); |
304 | return NULL; /* to avoid warnings */ | 301 | return NULL; /* to avoid warnings */ |