aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-09-19 10:49:12 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-09-19 10:49:12 -0300
commitbf96d3fdd9ee477faa774734453c27535a36b16f (patch)
treea4cb32ca0ab726c487f705c29af1db7e2ebf01f5
parentc8c2e06899b0a05d4af0b71ab527a930356dea08 (diff)
downloadlua-bf96d3fdd9ee477faa774734453c27535a36b16f.tar.gz
lua-bf96d3fdd9ee477faa774734453c27535a36b16f.tar.bz2
lua-bf96d3fdd9ee477faa774734453c27535a36b16f.zip
'string.find' as it was in 5.0
-rw-r--r--lstrlib.c7
-rw-r--r--luaconf.h10
2 files changed, 2 insertions, 15 deletions
diff --git a/lstrlib.c b/lstrlib.c
index 081de1c7..faf0f0f4 100644
--- a/lstrlib.c
+++ b/lstrlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstrlib.c,v 1.122 2005/08/15 14:12:32 roberto Exp roberto $ 2** $Id: lstrlib.c,v 1.123 2005/08/26 17:36:32 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*/
@@ -516,12 +516,7 @@ static int str_find_aux (lua_State *L, int find) {
516 if (find) { 516 if (find) {
517 lua_pushinteger(L, s1-s+1); /* start */ 517 lua_pushinteger(L, s1-s+1); /* start */
518 lua_pushinteger(L, res-s); /* end */ 518 lua_pushinteger(L, res-s); /* end */
519#if defined(LUA_COMPAT_FIND)
520 return push_captures(&ms, NULL, 0) + 2; 519 return push_captures(&ms, NULL, 0) + 2;
521#else
522 return 2;
523#endif
524
525 } 520 }
526 else 521 else
527 return push_captures(&ms, s1, res); 522 return push_captures(&ms, s1, res);
diff --git a/luaconf.h b/luaconf.h
index 62ca2c8f..c4bd3d51 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: luaconf.h,v 1.66 2005/09/14 17:23:03 roberto Exp roberto $ 2** $Id: luaconf.h,v 1.67 2005/09/14 17:44:48 roberto Exp roberto $
3** Configuration file for Lua 3** Configuration file for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -316,20 +316,12 @@
316#define LUA_COMPAT_LSTR 1 316#define LUA_COMPAT_LSTR 1
317 317
318/* 318/*
319@@ LUA_COMPAT_FIND controls compatibility with old 'string.find' behavior.
320** CHANGE it to undefined as soon as your programs use 'string.find' only
321** to find patterns.
322*/
323#define LUA_COMPAT_FIND
324
325/*
326@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name. 319@@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name.
327** CHANGE it to undefined as soon as you rename 'string.gfind' to 320** CHANGE it to undefined as soon as you rename 'string.gfind' to
328** 'string.gmatch'. 321** 'string.gmatch'.
329*/ 322*/
330#define LUA_COMPAT_GFIND 323#define LUA_COMPAT_GFIND
331 324
332
333/* 325/*
334@@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib' 326@@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib'
335@* behavior. 327@* behavior.