'_ENV' name permanently stored in global state for easier access

This commit is contained in:
Roberto Ierusalimschy
2010-03-13 12:55:42 -03:00
parent 63a2b62468
commit 22ef84b6c8
5 changed files with 11 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lstate.c,v 2.67 2009/12/17 12:26:09 roberto Exp roberto $
** $Id: lstate.c,v 2.68 2009/12/22 15:32:50 roberto Exp roberto $
** Global State
** See Copyright Notice in lua.h
*/
@@ -161,6 +161,8 @@ static void f_luaopen (lua_State *L, void *ud) {
luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */
luaT_init(L);
luaX_init(L);
g->envn = luaS_new(L, "_ENV");
luaS_fix(g->envn); /* never collect this name */
luaS_fix(luaS_newliteral(L, MEMERRMSG));
g->GCthreshold = 4*g->totalbytes;
}