| 615 | |
| 616 | |
| 617 | void luaG_errormsg (lua_State *L) { |
| 618 | StkId errfunc = NULL; |
| 619 | if (L->errfunc != 0) { |
| 620 | errfunc = restorestack(L, L->errfunc); |
| 621 | } else if (L->errfuncref) { /*BZ*/ |
| 622 | TValue* rv = registry(L); |
| 623 | if (ttistable(rv)) { |
| 624 | Table* rt = hvalue(rv); |
| 625 | TValue regIndex; |
| 626 | setnvalue(®Index, L->errfuncref); |
| 627 | errfunc = (StkId) luaH_get(rt, ®Index); |
| 628 | } |
| 629 | } |
| 630 | if (errfunc != NULL) { |
| 631 | if (!ttisfunction(errfunc)) { |
| 632 | luaD_throw(L, LUA_ERRERR); |
| 633 | } |
| 634 | setobjs2s(L, L->top, L->top - 1); /* move argument */ |
| 635 | setobjs2s(L, L->top - 1, errfunc); /* push function */ |
| 636 | incr_top(L); |
| 637 | luaD_call(L, L->top - 2, 1); /* call it */ |
| 638 | } |
| 639 | luaD_throw(L, LUA_ERRRUN); |
| 640 | } |
| 641 | |
| 642 | |
| 643 | void luaG_runerror (lua_State *L, const char *fmt, ...) { |
no test coverage detected