2 ** $Id: lstate.c,v 1.6 1998/06/02 20:37:04 roberto Exp $
4 ** See Copyright Notice in lua.h
20 lua_State
*lua_state
= NULL
;
25 if (lua_state
) return;
26 lua_state
= luaM_new(lua_State
);
32 L
->rootproto
.next
= NULL
;
33 L
->rootproto
.marked
= 0;
34 L
->rootcl
.next
= NULL
;
36 L
->rootglobal
.next
= NULL
;
37 L
->rootglobal
.marked
= 0;
38 L
->roottable
.next
= NULL
;
39 L
->roottable
.marked
= 0;
46 L
->GCthreshold
= GARBAGE_BLOCK
;
58 TaggedString
*alludata
= luaS_collectudata();
59 L
->GCthreshold
= MAX_INT
; /* to avoid GC during GC */
60 luaC_hashcallIM((Hash
*)L
->roottable
.next
); /* GC t.methods for tables */
61 luaC_strcallIM(alludata
); /* GC tag methods for userdata */
62 luaD_gcIM(&luaO_nilobject
); /* GC tag method for nil (signal end of GC) */
63 luaH_free((Hash
*)L
->roottable
.next
);
64 luaF_freeproto((TProtoFunc
*)L
->rootproto
.next
);
65 luaF_freeclosure((Closure
*)L
->rootcl
.next
);
68 luaM_free(L
->stack
.stack
);
69 luaM_free(L
->IMtable
);
70 luaM_free(L
->refArray
);
71 luaM_free(L
->Mbuffer
);
75 printf("total de blocos: %ld\n", numblocks
);
76 printf("total de memoria: %ld\n", totalmem
);
81 lua_State
*lua_setstate (lua_State
*st
) {
82 lua_State
*old
= lua_state
;