History

Lua 5.1.3-rc1

Lua Team committed 18 years ago

Commit ea97e791 parent 4d388a360 files · +732 −439Browse files

Showing the changes to src/lstrlib.c (1 of 60 files). Show all

Unified · Split

src/lstrlib.c+5−5
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lstrlib.c,v 1.132a 2006/04/26 20:41:19 roberto Exp $2** $Id: lstrlib.c,v 1.132.1.3 2007/12/28 15:32:23 roberto Exp $
3** Standard library for string operations and pattern-matching3** Standard library for string operations and pattern-matching
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -629,10 +629,6 @@ static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, · 623 unmodified lines
629 lua_gettable(L, 3);629 lua_gettable(L, 3);
630 break;630 break;
631 }631 }
632 default: {
633 luaL_argerror(L, 3, "string/function/table expected");
634 return;
635 }
636 }632 }
637 if (!lua_toboolean(L, -1)) { /* nil or false? */633 if (!lua_toboolean(L, -1)) { /* nil or false? */
638 lua_pop(L, 1);634 lua_pop(L, 1);
@@ -648,11 +644,15 @@ static int str_gsub (lua_State *L) { · 9 unmodified lines
648 size_t srcl;644 size_t srcl;
649 const char *src = luaL_checklstring(L, 1, &srcl);645 const char *src = luaL_checklstring(L, 1, &srcl);
650 const char *p = luaL_checkstring(L, 2);646 const char *p = luaL_checkstring(L, 2);
647 int tr = lua_type(L, 3);
651 int max_s = luaL_optint(L, 4, srcl+1);648 int max_s = luaL_optint(L, 4, srcl+1);
652 int anchor = (*p == '^') ? (p++, 1) : 0;649 int anchor = (*p == '^') ? (p++, 1) : 0;
653 int n = 0;650 int n = 0;
654 MatchState ms;651 MatchState ms;
655 luaL_Buffer b;652 luaL_Buffer b;
653 luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING ||
654 tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3,
655 "string/function/table expected");
656 luaL_buffinit(L, &b);656 luaL_buffinit(L, &b);
657 ms.L = L;657 ms.L = L;
658 ms.src_init = src;658 ms.src_init = src;