MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / getfunc

Function getfunc

Source/Misc/lua/src/lua.c:10981–10994  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10979
10980
10981static void getfunc (lua_State *L, int opt) {
10982if (lua_isfunction(L, 1)) lua_pushvalue(L, 1);
10983else {
10984lua_Debug ar;
10985int level = opt ? luaL_optint(L, 1, 1) : luaL_checkint(L, 1);
10986luaL_argcheck(L, level >= 0, 1, "level must be non-negative");
10987if (lua_getstack(L, level, &ar) == 0)
10988luaL_argerror(L, 1, "invalid level");
10989lua_getinfo(L, "f", &ar);
10990if (lua_isnil(L, -1))
10991luaL_error(L, "no function environment for tail call at level %d",
10992level);
10993}
10994}
10995
10996
10997static int luaB_getfenv (lua_State *L) {

Callers 2

luaB_getfenvFunction · 0.85
luaB_setfenvFunction · 0.85

Calls 5

lua_pushvalueFunction · 0.85
lua_getstackFunction · 0.85
luaL_argerrorFunction · 0.85
lua_getinfoFunction · 0.85
luaL_errorFunction · 0.85

Tested by

no test coverage detected