summaryrefslogtreecommitdiff
path: root/lstate.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-03-29 14:43:14 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-03-29 14:43:14 -0300
commita8d3aa14fdcbc8c8ee6512bbcb4ad51a488a1e57 (patch)
treebda3a46753aff65cef00562e405b999c47fbb15b /lstate.c
parent064e406f67c0153999a5246deb1d616b06ee9bb0 (diff)
downloadlua-a8d3aa14fdcbc8c8ee6512bbcb4ad51a488a1e57.tar.gz
lua-a8d3aa14fdcbc8c8ee6512bbcb4ad51a488a1e57.tar.bz2
lua-a8d3aa14fdcbc8c8ee6512bbcb4ad51a488a1e57.zip
global table now is only kept in the registry
Diffstat (limited to 'lstate.c')
-rw-r--r--lstate.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/lstate.c b/lstate.c
index d47e01c8..aad526c2 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.c,v 2.74 2010/03/25 19:37:23 roberto Exp roberto $ 2** $Id: lstate.c,v 2.75 2010/03/26 20:58:11 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -140,8 +140,8 @@ static void init_registry (lua_State *L, global_State *g) {
140 cp->c.f = ccall; 140 cp->c.f = ccall;
141 setclvalue(L, &mt, cp); 141 setclvalue(L, &mt, cp);
142 setobj2t(L, luaH_setint(L, registry, LUA_RIDX_CCALL), &mt); 142 setobj2t(L, luaH_setint(L, registry, LUA_RIDX_CCALL), &mt);
143 /* registry[LUA_RIDX_GLOBALS] = l_gt */ 143 /* registry[LUA_RIDX_GLOBALS] = table of globals */
144 sethvalue(L, &mt, g->l_gt); 144 sethvalue(L, &mt, luaH_new(L));
145 setobj2t(L, luaH_setint(L, registry, LUA_RIDX_GLOBALS), &mt); 145 setobj2t(L, luaH_setint(L, registry, LUA_RIDX_GLOBALS), &mt);
146} 146}
147 147
@@ -153,7 +153,6 @@ static void f_luaopen (lua_State *L, void *ud) {
153 global_State *g = G(L); 153 global_State *g = G(L);
154 UNUSED(ud); 154 UNUSED(ud);
155 stack_init(L, L); /* init stack */ 155 stack_init(L, L); /* init stack */
156 g->l_gt = luaH_new(L); /* table of globals */
157 init_registry(L, g); 156 init_registry(L, g);
158 luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */ 157 luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */
159 luaT_init(L); 158 luaT_init(L);
@@ -256,7 +255,6 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
256 g->strt.nuse = 0; 255 g->strt.nuse = 0;
257 g->strt.hash = NULL; 256 g->strt.hash = NULL;
258 setnilvalue(&g->l_registry); 257 setnilvalue(&g->l_registry);
259 g->l_gt = NULL;
260 luaZ_initbuffer(L, &g->buff); 258 luaZ_initbuffer(L, &g->buff);
261 g->panic = NULL; 259 g->panic = NULL;
262 g->version = lua_version(NULL); 260 g->version = lua_version(NULL);