diff options
Diffstat (limited to 'ltablib.c')
-rw-r--r-- | ltablib.c | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltablib.c,v 1.9 2002/07/01 19:25:28 roberto Exp roberto $ | 2 | ** $Id: ltablib.c,v 1.10 2002/07/08 16:51:20 roberto Exp roberto $ |
3 | ** Library for Table Manipulation | 3 | ** Library for Table Manipulation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -288,11 +288,7 @@ static const luaL_reg tab_funcs[] = { | |||
288 | 288 | ||
289 | LUALIB_API int lua_tablibopen (lua_State *L) { | 289 | LUALIB_API int lua_tablibopen (lua_State *L) { |
290 | lua_newtable(L); /* create N (table to store num. elements in tables) */ | 290 | lua_newtable(L); /* create N (table to store num. elements in tables) */ |
291 | lua_pushvalue(L, -1); | 291 | lua_setmode(L, -1, "k"); /* make it a weak table */ |
292 | lua_setmetatable(L, -2); /* make it its own metatable */ | ||
293 | lua_pushliteral(L, "__mode"); | ||
294 | lua_pushliteral(L, "k"); | ||
295 | lua_rawset(L, -3); /* make it a weak table */ | ||
296 | luaL_opennamedlib(L, LUA_TABLIBNAME, tab_funcs, 1); | 292 | luaL_opennamedlib(L, LUA_TABLIBNAME, tab_funcs, 1); |
297 | return 0; | 293 | return 0; |
298 | } | 294 | } |