luaL_findstring -> luaL_checkoption
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user