| 242 | |
| 243 | |
| 244 | static StkId tryfuncTM (lua_State *L, StkId func) { |
| 245 | const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL); |
| 246 | StkId p; |
| 247 | ptrdiff_t funcr = savestack(L, func); |
| 248 | if (!ttisfunction(tm)) |
| 249 | luaG_typeerror(L, func, "call"); |
| 250 | /* Open a hole inside the stack at `func' */ |
| 251 | for (p = L->top; p > func; p--) setobjs2s(L, p, p-1); |
| 252 | incr_top(L); |
| 253 | func = restorestack(L, funcr); /* previous call may change stack */ |
| 254 | setobj2s(L, func, tm); /* tag method is the new function to be called */ |
| 255 | return func; |
| 256 | } |
| 257 | |
| 258 | |
| 259 |
no test coverage detected