more options for controling the GC

This commit is contained in:
Roberto Ierusalimschy
2004-12-06 15:53:42 -02:00
parent 531874f6ce
commit 39a8082f50
7 changed files with 49 additions and 32 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lbaselib.c,v 1.159 2004/09/29 21:03:14 roberto Exp roberto $
** $Id: lbaselib.c,v 1.160 2004/11/18 19:53:49 roberto Exp roberto $
** Basic library
** See Copyright Notice in lua.h
*/
@@ -181,10 +181,10 @@ static int luaB_gcinfo (lua_State *L) {
static int luaB_collectgarbage (lua_State *L) {
static const char *const opts[] = {"stop", "restart", "collect", "count",
"step", NULL};
static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART,
LUA_GCCOLLECT, LUA_GCCOUNT, LUA_GCSTEP};
static const char *const opts[] = {"stop", "restart", "collect",
"count", "step", "setstepmul", "setincmode", NULL};
static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT,
LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETSTEPMUL, LUA_GCSETINCMODE};
int o = luaL_findstring(luaL_optstring(L, 1, "collect"), opts);
int ex = luaL_optint(L, 2, 0);
luaL_argcheck(L, o >= 0, 1, "invalid option");