MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / luaB_collectgarbage

Function luaB_collectgarbage

Source/Misc/lua/src/lua.c:11057–11080  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11055
11056
11057static int luaB_collectgarbage (lua_State *L) {
11058static const char *const opts[] = {"stop", "restart", "collect",
11059"count", "step", "setpause", "setstepmul", NULL};
11060static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT,
11061LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL};
11062int o = luaL_checkoption(L, 1, "collect", opts);
11063int ex = luaL_optint(L, 2, 0);
11064int res = lua_gc(L, optsnum[o], ex);
11065switch (optsnum[o]) {
11066case LUA_GCCOUNT: {
11067int b = lua_gc(L, LUA_GCCOUNTB, 0);
11068lua_pushnumber(L, res + ((lua_Number)b/1024));
11069return 1;
11070}
11071case LUA_GCSTEP: {
11072lua_pushboolean(L, res);
11073return 1;
11074}
11075default: {
11076lua_pushnumber(L, res);
11077return 1;
11078}
11079}
11080}
11081
11082
11083static int luaB_type (lua_State *L) {

Callers

nothing calls this directly

Calls 4

luaL_checkoptionFunction · 0.85
lua_gcFunction · 0.85
lua_pushnumberFunction · 0.85
lua_pushbooleanFunction · 0.85

Tested by

no test coverage detected