new option 'isrunning' for 'lua_gc' (and 'collectgarbage')

This commit is contained in:
Roberto Ierusalimschy
2009-11-09 16:55:17 -02:00
parent 88eb901f81
commit 1ce819333d
3 changed files with 15 additions and 9 deletions

6
lapi.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lapi.c,v 2.97 2009/11/06 17:03:37 roberto Exp roberto $
** $Id: lapi.c,v 2.98 2009/11/09 18:29:21 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -953,6 +953,10 @@ LUA_API int lua_gc (lua_State *L, int what, int data) {
g->gcstepmul = data;
break;
}
case LUA_GCISRUNNING: {
res = (g->GCthreshold != MAX_LUMEM);
break;
}
default: res = -1; /* invalid option */
}
lua_unlock(L);