From 634344d61fb4bd7ebd033d37b814a0083e55b5a2 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy <roberto@inf.puc-rio.br> Date: Tue, 6 Aug 2002 14:06:56 -0300 Subject: new API for weak mode --- ltablib.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'ltablib.c') diff --git a/ltablib.c b/ltablib.c index 11c8cc66..4842a688 100644 --- a/ltablib.c +++ b/ltablib.c @@ -1,5 +1,5 @@ /* -** $Id: ltablib.c,v 1.9 2002/07/01 19:25:28 roberto Exp roberto $ +** $Id: ltablib.c,v 1.10 2002/07/08 16:51:20 roberto Exp roberto $ ** Library for Table Manipulation ** See Copyright Notice in lua.h */ @@ -288,11 +288,7 @@ static const luaL_reg tab_funcs[] = { LUALIB_API int lua_tablibopen (lua_State *L) { lua_newtable(L); /* create N (table to store num. elements in tables) */ - lua_pushvalue(L, -1); - lua_setmetatable(L, -2); /* make it its own metatable */ - lua_pushliteral(L, "__mode"); - lua_pushliteral(L, "k"); - lua_rawset(L, -3); /* make it a weak table */ + lua_setmode(L, -1, "k"); /* make it a weak table */ luaL_opennamedlib(L, LUA_TABLIBNAME, tab_funcs, 1); return 0; } -- cgit v1.2.3-55-g6feb