diff options
-rw-r--r-- | lbaselib.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbaselib.c,v 1.203 2008/02/11 19:14:52 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.204 2008/02/14 16:03:09 roberto Exp roberto $ |
3 | ** Basic library | 3 | ** Basic library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -418,7 +418,9 @@ static int luaB_newproxy (lua_State *L) { | |||
418 | if (lua_toboolean(L, 1) == 0) | 418 | if (lua_toboolean(L, 1) == 0) |
419 | return 1; /* no metatable */ | 419 | return 1; /* no metatable */ |
420 | else if (lua_isboolean(L, 1)) { | 420 | else if (lua_isboolean(L, 1)) { |
421 | lua_newtable(L); /* create a new metatable `m' ... */ | 421 | lua_createtable(L, 0, 1); /* create a new metatable `m' ... */ |
422 | lua_pushboolean(L, 1); | ||
423 | lua_setfield(L, -2, "__gc"); /* ... m.__gc = false (HACK!!)... */ | ||
422 | lua_pushvalue(L, -1); /* ... and mark `m' as a valid metatable */ | 424 | lua_pushvalue(L, -1); /* ... and mark `m' as a valid metatable */ |
423 | lua_pushboolean(L, 1); | 425 | lua_pushboolean(L, 1); |
424 | lua_rawset(L, lua_upvalueindex(1)); /* weaktable[m] = true */ | 426 | lua_rawset(L, lua_upvalueindex(1)); /* weaktable[m] = true */ |