| 5387 | |
| 5388 | |
| 5389 | static StkId tryfuncTM (lua_State *L, StkId func) { |
| 5390 | const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL); |
| 5391 | StkId p; |
| 5392 | ptrdiff_t funcr = savestack(L, func); |
| 5393 | if (!ttisfunction(tm)) |
| 5394 | luaG_typeerror(L, func, "call"); |
| 5395 | /* Open a hole inside the stack at `func' */ |
| 5396 | for (p = L->top; p > func; p--) setobjs2s(L, p, p-1); |
| 5397 | incr_top(L); |
| 5398 | func = restorestack(L, funcr); /* previous call may change stack */ |
| 5399 | setobj2s(L, func, tm); /* tag method is the new function to be called */ |
| 5400 | return func; |
| 5401 | } |
| 5402 | |
| 5403 | |
| 5404 |
no test coverage detected