luaL_findstring -> luaL_checkoption

This commit is contained in:
Roberto Ierusalimschy
2005-05-25 10:21:26 -03:00
parent 38da9d568a
commit e8a7ecb982
5 changed files with 18 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lbaselib.c,v 1.176 2005/05/17 19:49:15 roberto Exp roberto $
** $Id: lbaselib.c,v 1.177 2005/05/20 15:53:42 roberto Exp roberto $
** Basic library
** See Copyright Notice in lua.h
*/
@@ -192,9 +192,8 @@ static int luaB_collectgarbage (lua_State *L) {
"count", "step", "setpause", "setstepmul", NULL};
static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT,
LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL};
int o = luaL_findstring(luaL_optstring(L, 1, "collect"), opts);
int o = luaL_checkoption(L, 1, "collect", opts);
int ex = luaL_optinteger(L, 2, 0);
luaL_argcheck(L, o >= 0, 1, "invalid option");
lua_pushinteger(L, lua_gc(L, optsnum[o], ex));
return 1;
}