| 84 | |
| 85 | |
| 86 | void luaT_callTM(lua_State *L, const TValue *f, const TValue *p1, |
| 87 | const TValue *p2, TValue *p3, int hasres) { |
| 88 | ptrdiff_t result = savestack(L, p3); |
| 89 | StkId func = L->top; |
| 90 | setobj2s(L, func, f); /* push function (assume EXTRA_STACK) */ |
| 91 | setobj2s(L, func + 1, p1); /* 1st argument */ |
| 92 | setobj2s(L, func + 2, p2); /* 2nd argument */ |
| 93 | L->top += 3; |
| 94 | if (!hasres) /* no result? 'p3' is third argument */ |
| 95 | setobj2s(L, L->top++, p3); /* 3rd argument */ |
| 96 | /* metamethod may yield only when called from Lua code */ |
| 97 | if (isLua(L->ci)) |
| 98 | luaD_call(L, func, hasres); |
| 99 | else |
| 100 | luaD_callnoyield(L, func, hasres); |
| 101 | if (hasres) { /* if has result, move it to its place */ |
| 102 | p3 = restorestack(L, result); |
| 103 | setobjs2s(L, p3, --L->top); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | |
| 108 | int luaT_callbinTM(lua_State *L, const TValue *p1, const TValue *p2, |
no test coverage detected