From 1ede98157db12ded9c6be1ed8ab8742bcf6c046d Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 4 Jul 2002 14:58:02 -0300 Subject: strings are always `strong' in weaktables --- lbaselib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lbaselib.c') diff --git a/lbaselib.c b/lbaselib.c index b166c59c..3edd8050 100644 --- a/lbaselib.c +++ b/lbaselib.c @@ -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 ** See Copyright Notice in lua.h */ @@ -571,11 +571,11 @@ static void base_open (lua_State *L) { /* `newproxy' needs a weaktable as upvalue */ lua_pushliteral(L, "newproxy"); 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, "k"); lua_rawset(L, -3); /* metatable(w).__mode = "k" */ - lua_setmetatable(L, -2); lua_pushcclosure(L, luaB_newproxy, 1); lua_rawset(L, -3); /* set global `newproxy' */ lua_rawset(L, -1); /* set global _G */ -- cgit v1.2.3-55-g6feb