MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / luaD_throw

Function luaD_throw

extlibs/lua/src/ldo.c:114–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112
113
114l_noret luaD_throw (lua_State *L, int errcode) {
115 if (L->errorJmp) { /* thread has an error handler? */
116 L->errorJmp->status = errcode; /* set status */
117 LUAI_THROW(L, L->errorJmp); /* jump to it */
118 }
119 else { /* thread has no error handler */
120 global_State *g = G(L);
121 errcode = luaF_close(L, L->stack, errcode); /* close all upvalues */
122 L->status = cast_byte(errcode); /* mark it as dead */
123 if (g->mainthread->errorJmp) { /* main thread has a handler? */
124 setobjs2s(L, g->mainthread->top++, L->top - 1); /* copy error obj. */
125 luaD_throw(g->mainthread, errcode); /* re-throw in main thread */
126 }
127 else { /* no handler at all; abort */
128 if (g->panic) { /* panic function? */
129 luaD_seterrorobj(L, errcode, L->top); /* assume EXTRA_STACK */
130 if (L->ci->top < L->top)
131 L->ci->top = L->top; /* pushing msg. can break this invariant */
132 lua_unlock(L);
133 g->panic(L); /* call panic function (last chance to jump out) */
134 }
135 abort();
136 }
137 }
138}
139
140
141int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) {

Callers 9

lexerrorFunction · 0.85
luaE_enterCcallFunction · 0.85
errorFunction · 0.85
luaG_errormsgFunction · 0.85
luaG_traceexecFunction · 0.85
luaF_newtbcupvalFunction · 0.85
luaD_growstackFunction · 0.85
lua_yieldkFunction · 0.85
checkmodeFunction · 0.85

Calls 2

luaF_closeFunction · 0.85
luaD_seterrorobjFunction · 0.85

Tested by

no test coverage detected