| 90 | |
| 91 | |
| 92 | static void callTM (lua_State *L, const TValue *f, const TValue *p1, |
| 93 | const TValue *p2, TValue *p3, int hasres) { |
| 94 | if (L == NULL) return; |
| 95 | |
| 96 | ptrdiff_t result = savestack(L, p3); |
| 97 | setobj2s(L, L->top++, f); /* push function */ |
| 98 | setobj2s(L, L->top++, p1); /* 1st argument */ |
| 99 | setobj2s(L, L->top++, p2); /* 2nd argument */ |
| 100 | if (!hasres) /* no result? 'p3' is third argument */ |
| 101 | setobj2s(L, L->top++, p3); /* 3rd argument */ |
| 102 | /* metamethod may yield only when called from Lua code */ |
| 103 | luaD_call(L, L->top - (4 - hasres), hasres, isLua(L->ci)); |
| 104 | if (hasres) { /* if has result, move it to its place */ |
| 105 | p3 = restorestack(L, result); |
| 106 | setobjs2s(L, p3, --L->top); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | |
| 111 | void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) { |
no test coverage detected