diff options
author | pixel <pixel> | 2008-02-17 00:35:20 +0000 |
---|---|---|
committer | pixel <pixel> | 2008-02-17 00:35:20 +0000 |
commit | 658b29261ca0a68f1c5f7f3c3efa20ab56a543b6 (patch) | |
tree | e3caffa9a9ed1d80e1f8e23d8e848176d5f08413 /lib/lua/src/LuaLib/lstrlib.c | |
parent | 546a2ad1f72410fd042625cd44d192804e3ea2d7 (diff) |
Upgrading to Lua 5.1.3
Diffstat (limited to 'lib/lua/src/LuaLib/lstrlib.c')
-rw-r--r-- | lib/lua/src/LuaLib/lstrlib.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/lua/src/LuaLib/lstrlib.c b/lib/lua/src/LuaLib/lstrlib.c index 8310752..7198464 100644 --- a/lib/lua/src/LuaLib/lstrlib.c +++ b/lib/lua/src/LuaLib/lstrlib.c @@ -1,5 +1,5 @@ /* -** $Id: lstrlib.c,v 1.5 2007-07-27 10:05:55 pixel Exp $ +** $Id: lstrlib.c,v 1.6 2008-02-17 00:35:21 pixel Exp $ ** Standard library for string operations and pattern-matching ** See Copyright Notice in lua.h */ @@ -629,10 +629,6 @@ static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, lua_gettable(L, 3); break; } - default: { - luaL_argerror(L, 3, "string/function/table expected"); - return; - } } if (!lua_toboolean(L, -1)) { /* nil or false? */ lua_pop(L, 1); @@ -648,11 +644,15 @@ static int str_gsub (lua_State *L) { size_t srcl; const char *src = luaL_checklstring(L, 1, &srcl); const char *p = luaL_checkstring(L, 2); + int tr = lua_type(L, 3); int max_s = luaL_optint(L, 4, srcl+1); int anchor = (*p == '^') ? (p++, 1) : 0; int n = 0; MatchState ms; luaL_Buffer b; + luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING || + tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3, + "string/function/table expected"); luaL_buffinit(L, &b); ms.L = L; ms.src_init = src; |