MCPcopy Create free account
hub / github.com/DFHack/dfhack / luaB_collectgarbage

Function luaB_collectgarbage

depends/lua/src/lbaselib.c:173–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171
172
173static int luaB_collectgarbage (lua_State *L) {
174 static const char *const opts[] = {"stop", "restart", "collect",
175 "count", "step", "setpause", "setstepmul",
176 "isrunning", NULL};
177 static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT,
178 LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL,
179 LUA_GCISRUNNING};
180 int o = optsnum[luaL_checkoption(L, 1, "collect", opts)];
181 int ex = (int)luaL_optinteger(L, 2, 0);
182 int res = lua_gc(L, o, ex);
183 switch (o) {
184 case LUA_GCCOUNT: {
185 int b = lua_gc(L, LUA_GCCOUNTB, 0);
186 lua_pushnumber(L, (lua_Number)res + ((lua_Number)b/1024));
187 return 1;
188 }
189 case LUA_GCSTEP: case LUA_GCISRUNNING: {
190 lua_pushboolean(L, res);
191 return 1;
192 }
193 default: {
194 lua_pushinteger(L, res);
195 return 1;
196 }
197 }
198}
199
200
201static int luaB_type (lua_State *L) {

Callers

nothing calls this directly

Calls 6

luaL_checkoptionFunction · 0.85
luaL_optintegerFunction · 0.85
lua_gcFunction · 0.85
lua_pushnumberFunction · 0.85
lua_pushbooleanFunction · 0.85
lua_pushintegerFunction · 0.85

Tested by

no test coverage detected