1
0
mirror of https://github.com/lua/lua.git synced 2025-01-14 05:43:00 +08:00

'T.gccolor' classify dead objects too

This commit is contained in:
Roberto Ierusalimschy 2014-09-01 14:58:55 -03:00
parent df608f842a
commit 22952d8973

View File

@ -1,5 +1,5 @@
/*
** $Id: ltests.c,v 2.182 2014/07/23 16:44:30 roberto Exp roberto $
** $Id: ltests.c,v 2.183 2014/08/01 17:33:08 roberto Exp roberto $
** Internal Module for Debugging of the Lua Implementation
** See Copyright Notice in lua.h
*/
@ -598,9 +598,12 @@ static int gc_color (lua_State *L) {
o = obj_at(L, 1);
if (!iscollectable(o))
lua_pushstring(L, "no collectable");
else
lua_pushstring(L, iswhite(gcvalue(o)) ? "white" :
isblack(gcvalue(o)) ? "black" : "grey");
else {
GCObject *obj = gcvalue(o);
lua_pushstring(L, isdead(G(L), obj) ? "dead" :
iswhite(obj) ? "white" :
isblack(obj) ? "black" : "grey");
}
return 1;
}