diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-12-15 09:25:16 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-12-15 09:25:16 -0200 |
commit | a25b8ff69c76515563c18dad715ee8daa8b847fd (patch) | |
tree | f00851e8ba5098c802159b1a7f49bae13273af97 /lbaselib.c | |
parent | 15b823ce4fde81d20486428e52a5a608d62f2465 (diff) | |
download | lua-a25b8ff69c76515563c18dad715ee8daa8b847fd.tar.gz lua-a25b8ff69c76515563c18dad715ee8daa8b847fd.tar.bz2 lua-a25b8ff69c76515563c18dad715ee8daa8b847fd.zip |
detail ('lua_tolstring' instead of lua_objlen)
Diffstat (limited to 'lbaselib.c')
-rw-r--r-- | lbaselib.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.230 2009/12/10 18:17:37 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.231 2009/12/11 13:40:44 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 | */ |
@@ -346,12 +346,13 @@ static const char *generic_reader (lua_State *L, void *ud, size_t *size) { | |||
346 | static int luaB_load_aux (lua_State *L, int farg) { | 346 | static int luaB_load_aux (lua_State *L, int farg) { |
347 | int status; | 347 | int status; |
348 | Readstat stat; | 348 | Readstat stat; |
349 | const char *s = lua_tostring(L, farg); | 349 | size_t l; |
350 | const char *s = lua_tolstring(L, farg, &l); | ||
350 | stat.mode = luaL_optstring(L, farg + 2, "bt"); | 351 | stat.mode = luaL_optstring(L, farg + 2, "bt"); |
351 | if (s != NULL) { /* loading a string? */ | 352 | if (s != NULL) { /* loading a string? */ |
352 | const char *chunkname = luaL_optstring(L, farg + 1, s); | 353 | const char *chunkname = luaL_optstring(L, farg + 1, s); |
353 | status = (checkrights(L, stat.mode, s) != NULL) | 354 | status = (checkrights(L, stat.mode, s) != NULL) |
354 | || luaL_loadbuffer(L, s, lua_objlen(L, farg), chunkname); | 355 | || luaL_loadbuffer(L, s, l, chunkname); |
355 | } | 356 | } |
356 | else { /* loading from a reader function */ | 357 | else { /* loading from a reader function */ |
357 | const char *chunkname = luaL_optstring(L, farg + 1, "=(load)"); | 358 | const char *chunkname = luaL_optstring(L, farg + 1, "=(load)"); |