Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CLI/src/Repl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ static int lua_collectgarbage(lua_State* L)

if (strcmp(option, "count") == 0)
{
int c = lua_gc(L, LUA_GCCOUNT, 0);
lua_pushnumber(L, c);
int k = lua_gc(L, LUA_GCCOUNT, 0);
int b = lua_gc(L, LUA_GCCOUNTB, 0);
lua_pushnumber(L, double(k) + double(b) / 1024);
return 1;
}

Expand Down
4 changes: 3 additions & 1 deletion VM/src/lbaselib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ static int luaB_rawlen(lua_State* L)

static int luaB_gcinfo(lua_State* L)
{
lua_pushinteger(L, lua_gc(L, LUA_GCCOUNT, 0));
int k = lua_gc(L, LUA_GCCOUNT, 0);
int b = lua_gc(L, LUA_GCCOUNTB, 0);
lua_pushnumber(L, (double)k + (double)b / 1024);
return 1;
}

Expand Down
7 changes: 7 additions & 0 deletions tests/Conformance.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ static int lua_collectgarbage(lua_State* L)
int res = lua_gc(L, optsnum[o], ex);
switch (optsnum[o])
{
case LUA_GCCOUNT:
{
int k = lua_gc(L, LUA_GCCOUNT, 0);
int b = lua_gc(L, LUA_GCCOUNTB, 0);
lua_pushnumber(L, double(k) + double(b) / 1024);
return 1;
}
case LUA_GCSTEP:
case LUA_GCISRUNNING:
{
Expand Down
Loading