From 0e0e4a480e6d9b0125a96ca982a3e9571578a037 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 11 Apr 2001 11:42:41 -0300 Subject: first implementation for weak tables --- ltests.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'ltests.c') diff --git a/ltests.c b/ltests.c index 4b8fcd01..d012df8b 100644 --- a/ltests.c +++ b/ltests.c @@ -1,5 +1,5 @@ /* -** $Id: ltests.c,v 1.76 2001/03/09 18:05:05 roberto Exp roberto $ +** $Id: ltests.c,v 1.77 2001/03/26 14:31:49 roberto Exp roberto $ ** Internal Module for Debugging of the Lua Implementation ** See Copyright Notice in lua.h */ @@ -337,9 +337,16 @@ static int table_query (lua_State *L) { return 2; } else if (i < t->size) { - TObject o; - setkey2obj(&o, &t->node[i]); - luaA_pushobject(L, &o); + if (ttype(val(node(t, i))) != LUA_TNIL || + ttype_key(node(t, i)) == LUA_TNIL || + ttype_key(node(t, i)) == LUA_TNUMBER || + tsvalue_key(node(t, i)) != NULL) { + TObject o; + setkey2obj(&o, node(t, i)); + luaA_pushobject(L, &o); + } + else + lua_pushstring(L, ""); luaA_pushobject(L, &t->node[i].val); if (t->node[i].next) { lua_pushnumber(L, t->node[i].next - t->node); -- cgit v1.2.3-55-g6feb