Add LUA_GCCOUNTB option for lua_gc

This commit is contained in:
Petri Häkkinen 2021-11-30 09:10:19 +02:00
parent 6958716ccd
commit c6c8636457
2 changed files with 6 additions and 0 deletions

View file

@ -231,6 +231,7 @@ enum lua_GCOp
LUA_GCRESTART,
LUA_GCCOLLECT,
LUA_GCCOUNT,
LUA_GCCOUNTB,
LUA_GCISRUNNING,
// garbage collection is handled by 'assists' that perform some amount of GC work matching pace of allocation

View file

@ -1039,6 +1039,11 @@ int lua_gc(lua_State* L, int what, int data)
res = cast_int(g->totalbytes >> 10);
break;
}
case LUA_GCCOUNTB:
{
res = cast_int(g->totalbytes & 1023);
break;
}
case LUA_GCISRUNNING:
{
res = (g->GCthreshold != SIZE_MAX);