aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-10-31 15:26:04 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-10-31 15:26:04 -0200
commit9d0044ce53809189ccb66c1c42e722b7dc94f46a (patch)
treeba25530b3e5b8003a189b8d98e26505c42e95412
parent37bf74efb7902cfc075c0249bff513187668adae (diff)
downloadlua-9d0044ce53809189ccb66c1c42e722b7dc94f46a.tar.gz
lua-9d0044ce53809189ccb66c1c42e722b7dc94f46a.tar.bz2
lua-9d0044ce53809189ccb66c1c42e722b7dc94f46a.zip
"strfind" has an extra parameter to turn off all special characteres.
-rw-r--r--strlib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/strlib.c b/strlib.c
index 78c6012c..7000bdc2 100644
--- a/strlib.c
+++ b/strlib.c
@@ -3,7 +3,7 @@
3** String library to LUA 3** String library to LUA
4*/ 4*/
5 5
6char *rcs_strlib="$Id: strlib.c,v 1.28 1996/09/16 18:02:40 roberto Exp roberto $"; 6char *rcs_strlib="$Id: strlib.c,v 1.29 1996/09/20 18:20:44 roberto Exp roberto $";
7 7
8#include <string.h> 8#include <string.h>
9#include <stdio.h> 9#include <stdio.h>
@@ -363,7 +363,8 @@ static void str_find (void)
363 char *p = lua_check_string(2, "find"); 363 char *p = lua_check_string(2, "find");
364 long init = lua_opt_number(3, 1, "strfind") - 1; 364 long init = lua_opt_number(3, 1, "strfind") - 1;
365 lua_arg_check(0 <= init && init <= strlen(s), "find"); 365 lua_arg_check(0 <= init && init <= strlen(s), "find");
366 if (strpbrk(p, SPECIALS) == NULL) { /* no special caracters? */ 366 if (lua_getparam(4) != LUA_NOOBJECT ||
367 strpbrk(p, SPECIALS) == NULL) { /* no special caracters? */
367 char *s2 = strstr(s+init, p); 368 char *s2 = strstr(s+init, p);
368 if (s2) { 369 if (s2) {
369 lua_pushnumber(s2-s+1); 370 lua_pushnumber(s2-s+1);