diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-05-16 16:21:11 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-05-16 16:21:11 -0300 |
commit | da32450c3d4c8abd3fd6709692859a12a8886511 (patch) | |
tree | a75289cd092dd6cbd9e454c9689de3b9c4d5de33 /lstrlib.c | |
parent | a2b78aad49388c1fd5286773085ef8a35545faa6 (diff) | |
download | lua-da32450c3d4c8abd3fd6709692859a12a8886511.tar.gz lua-da32450c3d4c8abd3fd6709692859a12a8886511.tar.bz2 lua-da32450c3d4c8abd3fd6709692859a12a8886511.zip |
new API function `lua_tolstring'
Diffstat (limited to 'lstrlib.c')
-rw-r--r-- | lstrlib.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstrlib.c,v 1.111 2005/03/22 16:54:29 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.112 2005/05/05 15:34:03 roberto Exp roberto $ |
3 | ** Standard library for string operations and pattern-matching | 3 | ** Standard library for string operations and pattern-matching |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -525,8 +525,8 @@ static int str_find (lua_State *L) { | |||
525 | 525 | ||
526 | static int gfind_aux (lua_State *L) { | 526 | static int gfind_aux (lua_State *L) { |
527 | MatchState ms; | 527 | MatchState ms; |
528 | const char *s = lua_tostring(L, lua_upvalueindex(1)); | 528 | size_t ls; |
529 | size_t ls = lua_strlen(L, lua_upvalueindex(1)); | 529 | const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls); |
530 | const char *p = lua_tostring(L, lua_upvalueindex(2)); | 530 | const char *p = lua_tostring(L, lua_upvalueindex(2)); |
531 | const char *src; | 531 | const char *src; |
532 | ms.L = L; | 532 | ms.L = L; |
@@ -563,8 +563,8 @@ static void add_s (MatchState *ms, luaL_Buffer *b, | |||
563 | const char *s, const char *e) { | 563 | const char *s, const char *e) { |
564 | lua_State *L = ms->L; | 564 | lua_State *L = ms->L; |
565 | if (lua_isstring(L, 3)) { | 565 | if (lua_isstring(L, 3)) { |
566 | const char *news = lua_tostring(L, 3); | 566 | size_t l; |
567 | size_t l = lua_strlen(L, 3); | 567 | const char *news = lua_tolstring(L, 3, &l); |
568 | size_t i; | 568 | size_t i; |
569 | for (i=0; i<l; i++) { | 569 | for (i=0; i<l; i++) { |
570 | if (news[i] != L_ESC) | 570 | if (news[i] != L_ESC) |