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