summaryrefslogtreecommitdiff
path: root/lstate.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-10-24 17:12:06 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-10-24 17:12:06 -0200
commitcdc8139e295a768ac581e0a7c784c1adfee0668b (patch)
treee1c4bd9160e5877ee6b61857d7ddbc33f78cff18 /lstate.c
parente833bd47c9c48f3235097b85f0e45f79ab5c00dd (diff)
downloadlua-cdc8139e295a768ac581e0a7c784c1adfee0668b.tar.gz
lua-cdc8139e295a768ac581e0a7c784c1adfee0668b.tar.bz2
lua-cdc8139e295a768ac581e0a7c784c1adfee0668b.zip
registry mechanism
Diffstat (limited to 'lstate.c')
-rw-r--r--lstate.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lstate.c b/lstate.c
index bd07488a..ba7ed328 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.c,v 1.44 2000/10/06 19:28:47 roberto Exp roberto $ 2** $Id: lstate.c,v 1.45 2000/10/20 16:39:03 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*/
@@ -47,16 +47,19 @@ static void f_luaopen (lua_State *L, void *ud) {
47 stacksize = DEFAULT_STACK_SIZE; 47 stacksize = DEFAULT_STACK_SIZE;
48 else 48 else
49 stacksize += LUA_MINSTACK; 49 stacksize += LUA_MINSTACK;
50 L->gt = luaH_new(L, 10); 50 L->gt = luaH_new(L, 10); /* table of globals */
51 luaD_init(L, stacksize); 51 luaD_init(L, stacksize);
52 luaS_init(L); 52 luaS_init(L);
53 luaX_init(L); 53 luaX_init(L);
54 luaT_init(L); 54 luaT_init(L);
55 lua_newtable(L);
56 lua_ref(L, 1); /* create registry */
55 lua_register(L, LUA_ERRORMESSAGE, errormessage); 57 lua_register(L, LUA_ERRORMESSAGE, errormessage);
56#ifdef DEBUG 58#ifdef DEBUG
57 luaB_opentests(L); 59 luaB_opentests(L);
58 if (lua_state == NULL) lua_state = L; /* keep first state to be opened */ 60 if (lua_state == NULL) lua_state = L; /* keep first state to be opened */
59#endif 61#endif
62 LUA_ASSERT(lua_gettop(L) == 0, "wrong API stack");
60} 63}
61 64
62 65