|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
-** $Id: lbaselib.c,v 1.144 2004/05/31 18:50:30 roberto Exp roberto $
|
|
|
+** $Id: lbaselib.c,v 1.145 2004/06/02 14:20:08 roberto Exp roberto $
|
|
|
** Basic library
|
|
|
** See Copyright Notice in lua.h
|
|
|
*/
|
|
@@ -180,22 +180,11 @@ static int luaB_gcinfo (lua_State *L) {
|
|
|
|
|
|
static int luaB_collectgarbage (lua_State *L) {
|
|
|
static const char *const opts[] = {"stop", "restart", "collect", "count",
|
|
|
- NULL};
|
|
|
+ "step", NULL};
|
|
|
static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART,
|
|
|
- LUA_GCCOLLECT, LUA_GCCOUNT};
|
|
|
- int o;
|
|
|
- int ex;
|
|
|
-#if 1
|
|
|
- if (lua_isnumber(L, 1)) {
|
|
|
- int v = lua_tointeger(L, 1);
|
|
|
- lua_settop(L, 0);
|
|
|
- if (v == 0) lua_pushstring(L, "collect");
|
|
|
- else if (v >= 10000) lua_pushstring(L, "stop");
|
|
|
- else lua_pushstring(L, "restart");
|
|
|
- }
|
|
|
-#endif
|
|
|
- o = luaL_findstring(luaL_optstring(L, 1, "collect"), opts);
|
|
|
- ex = luaL_optint(L, 2, 0);
|
|
|
+ LUA_GCCOLLECT, LUA_GCCOUNT, LUA_GCSTEP};
|
|
|
+ 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");
|
|
|
lua_pushinteger(L, lua_gc(L, optsnum[o], ex));
|
|
|
return 1;
|