| 342 | |
| 343 | |
| 344 | static StkId tryfuncTM (lua_State *L, StkId func) { |
| 345 | const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL); |
| 346 | StkId p; |
| 347 | ptrdiff_t funcr = savestack(L, func); |
| 348 | if (!ttisfunction(tm)) |
| 349 | luaG_typeerror(L, func, "call"); |
| 350 | /* Open a hole inside the stack at `func' */ |
| 351 | for (p = L->top; p > func; p--) setobjs2s(L, p, p-1); |
| 352 | incr_top(L); |
| 353 | func = restorestack(L, funcr); /* previous call may change stack */ |
| 354 | setobj2s(L, func, tm); /* tag method is the new function to be called */ |
| 355 | return func; |
| 356 | } |
| 357 | |
| 358 | |
| 359 |
no test coverage detected