MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / tryfuncTM

Function tryfuncTM

ThirdParty/lua/lua/ldo.c:294–304  ·  view source on GitHub ↗

** Check whether __call metafield of 'func' is a function. If so, put ** it in stack below original 'func' so that 'luaD_precall' can call ** it. Raise an error if __call metafield is not a function. */

Source from the content-addressed store, hash-verified

292** it. Raise an error if __call metafield is not a function.
293*/
294static void tryfuncTM (lua_State *L, StkId func) {
295 const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL);
296 StkId p;
297 if (!ttisfunction(tm))
298 luaG_typeerror(L, func, "call");
299 /* Open a hole inside the stack at 'func' */
300 for (p = L->top; p > func; p--)
301 setobjs2s(L, p, p-1);
302 L->top++; /* slot ensured by caller */
303 setobj2s(L, func, tm); /* tag method is the new function to be called */
304}
305
306
307

Callers 1

luaD_precallFunction · 0.85

Calls 2

luaT_gettmbyobjFunction · 0.85
luaG_typeerrorFunction · 0.85

Tested by

no test coverage detected