strings are always `strong' in weaktables
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lbaselib.c,v 1.88 2002/06/26 20:36:17 roberto Exp roberto $
|
** $Id: lbaselib.c,v 1.89 2002/07/01 19:23:58 roberto Exp roberto $
|
||||||
** Basic library
|
** Basic library
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -571,11 +571,11 @@ static void base_open (lua_State *L) {
|
|||||||
/* `newproxy' needs a weaktable as upvalue */
|
/* `newproxy' needs a weaktable as upvalue */
|
||||||
lua_pushliteral(L, "newproxy");
|
lua_pushliteral(L, "newproxy");
|
||||||
lua_newtable(L); /* new table `w' */
|
lua_newtable(L); /* new table `w' */
|
||||||
lua_newtable(L); /* create `w's metatable */
|
lua_pushvalue(L, -1); /* `w' will be its own metatable */
|
||||||
|
lua_setmetatable(L, -2);
|
||||||
lua_pushliteral(L, "__mode");
|
lua_pushliteral(L, "__mode");
|
||||||
lua_pushliteral(L, "k");
|
lua_pushliteral(L, "k");
|
||||||
lua_rawset(L, -3); /* metatable(w).__mode = "k" */
|
lua_rawset(L, -3); /* metatable(w).__mode = "k" */
|
||||||
lua_setmetatable(L, -2);
|
|
||||||
lua_pushcclosure(L, luaB_newproxy, 1);
|
lua_pushcclosure(L, luaB_newproxy, 1);
|
||||||
lua_rawset(L, -3); /* set global `newproxy' */
|
lua_rawset(L, -3); /* set global `newproxy' */
|
||||||
lua_rawset(L, -1); /* set global _G */
|
lua_rawset(L, -1); /* set global _G */
|
||||||
|
|||||||
9
lgc.c
9
lgc.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lgc.c,v 1.139 2002/06/25 19:17:42 roberto Exp roberto $
|
** $Id: lgc.c,v 1.140 2002/07/01 17:06:58 roberto Exp roberto $
|
||||||
** Garbage Collector
|
** Garbage Collector
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -263,15 +263,16 @@ static void propagatemarks (GCState *st) {
|
|||||||
|
|
||||||
static int hasmark (const TObject *o) {
|
static int hasmark (const TObject *o) {
|
||||||
switch (ttype(o)) {
|
switch (ttype(o)) {
|
||||||
case LUA_TSTRING:
|
|
||||||
return tsvalue(o)->tsv.marked;
|
|
||||||
case LUA_TUSERDATA:
|
case LUA_TUSERDATA:
|
||||||
return isudmarked(uvalue(o));
|
return isudmarked(uvalue(o));
|
||||||
case LUA_TTABLE:
|
case LUA_TTABLE:
|
||||||
return ismarked(hvalue(o));
|
return ismarked(hvalue(o));
|
||||||
case LUA_TFUNCTION:
|
case LUA_TFUNCTION:
|
||||||
return clvalue(o)->c.marked;
|
return clvalue(o)->c.marked;
|
||||||
default: /* number, nil, boolean */
|
case LUA_TSTRING:
|
||||||
|
strmark(tsvalue(o)); /* strings are `values', so are never weak */
|
||||||
|
/* go through */
|
||||||
|
default: /* number, nil, boolean, udataval */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user