concat' goes to table' library

This commit is contained in:
Roberto Ierusalimschy 2002-06-26 16:28:08 -03:00
parent f32a8c0477
commit cfcf200806

View File

@ -1,5 +1,5 @@
/*
** $Id: lstrlib.c,v 1.85 2002/06/18 15:16:18 roberto Exp roberto $
** $Id: lstrlib.c,v 1.86 2002/06/25 19:16:44 roberto Exp roberto $
** Standard library for string operations and pattern-matching
** See Copyright Notice in lua.h
*/
@ -92,25 +92,6 @@ static int str_rep (lua_State *L) {
}
static int str_concat (lua_State *L) {
luaL_Buffer b;
size_t lsep;
const char *sep = luaL_opt_lstr(L, 2, "", &lsep);
int n, i;
luaL_check_type(L, 1, LUA_TTABLE);
luaL_buffinit(L, &b);
n = lua_getn(L, 1);
for (i=1; i<=n; i++) {
lua_rawgeti(L, 1, i);
luaL_addvalue(&b);
if (i != n)
luaL_addlstring(&b, sep, lsep);
}
luaL_pushresult(&b);
return 1;
}
static int str_byte (lua_State *L) {
size_t l;
const char *s = luaL_check_lstr(L, 1, &l);
@ -713,7 +694,6 @@ static const luaL_reg strlib[] = {
{"char", str_char},
{"rep", str_rep},
{"byte", str_byte},
{"concat", str_concat},
{"format", str_format},
{"find", str_find},
{"gfind", gfind},