summaryrefslogtreecommitdiff
path: root/src/lstate.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lstate.c')
-rw-r--r--src/lstate.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lstate.c b/src/lstate.c
index 2a4ace12..77e93fbd 100644
--- a/src/lstate.c
+++ b/src/lstate.c
@@ -1,5 +1,5 @@
/*
-** $Id: lstate.c,v 2.33 2005/08/25 15:39:16 roberto Exp $
+** $Id: lstate.c,v 2.35 2005/10/06 20:46:25 roberto Exp $
** Global State
** See Copyright Notice in lua.h
*/
@@ -71,8 +71,8 @@ static void f_luaopen (lua_State *L, void *ud) {
global_State *g = G(L);
UNUSED(ud);
stack_init(L, L); /* init stack */
- sethvalue(L, gt(L), luaH_new(L, 0, 20)); /* table of globals */
- sethvalue(L, registry(L), luaH_new(L, 6, 20)); /* registry */
+ sethvalue(L, gt(L), luaH_new(L, 0, 2)); /* table of globals */
+ sethvalue(L, registry(L), luaH_new(L, 0, 2)); /* registry */
luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */
luaT_init(L);
luaX_init(L);
@@ -134,6 +134,7 @@ lua_State *luaE_newthread (lua_State *L) {
void luaE_freethread (lua_State *L, lua_State *L1) {
luaF_close(L1, L1->stack); /* close all upvalues for this thread */
lua_assert(L1->openupval == NULL);
+ luai_userstatefree(L1);
freestack(L, L1);
luaM_freemem(L, fromstate(L1), state_size(lua_State));
}
@@ -196,8 +197,9 @@ static void callallgcTM (lua_State *L, void *ud) {
LUA_API void lua_close (lua_State *L) {
- lua_lock(L);
L = G(L)->mainthread; /* only the main thread can be closed */
+ luai_userstateclose(L);
+ lua_lock(L);
luaF_close(L, L->stack); /* close all upvalues for this thread */
luaC_separateudata(L, 1); /* separate udata that have GC metamethods */
L->errfunc = 0; /* no error function during GC metamethods */