MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / tryfuncTM

Function tryfuncTM

other_src/lua/src/ldo.cpp:243–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

luaD_precallFunction · 0.70

Calls 2

luaT_gettmbyobjFunction · 0.70
luaG_typeerrorFunction · 0.70

Tested by

no test coverage detected