| 9112 | |
| 9113 | |
| 9114 | LUA_API void lua_close (lua_State *L) { |
| 9115 | L = G(L)->mainthread; /* only the main thread can be closed */ |
| 9116 | lua_lock(L); |
| 9117 | luaF_close(L, L->stack); /* close all upvalues for this thread */ |
| 9118 | luaC_separateudata(L, 1); /* separate udata that have GC metamethods */ |
| 9119 | L->errfunc = 0; /* no error function during GC metamethods */ |
| 9120 | do { /* repeat until no more errors */ |
| 9121 | L->ci = L->base_ci; |
| 9122 | L->base = L->top = L->ci->base; |
| 9123 | L->nCcalls = L->baseCcalls = 0; |
| 9124 | } while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0); |
| 9125 | lua_assert(G(L)->tmudata == NULL); |
| 9126 | luai_userstateclose(L); |
| 9127 | close_state(L); |
| 9128 | } |
| 9129 | |
| 9130 | /* |
| 9131 | ** $Id: lstring.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ |
no test coverage detected