MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / getfunc

Function getfunc

third-party/lua-5.1.5/src/lbaselib.c:117–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115
116
117static void getfunc (lua_State *L, int opt) {
118 if (lua_isfunction(L, 1)) lua_pushvalue(L, 1);
119 else {
120 lua_Debug ar;
121 int level = opt ? luaL_optint(L, 1, 1) : luaL_checkint(L, 1);
122 luaL_argcheck(L, level >= 0, 1, "level must be non-negative");
123 if (lua_getstack(L, level, &ar) == 0)
124 luaL_argerror(L, 1, "invalid level");
125 lua_getinfo(L, "f", &ar);
126 if (lua_isnil(L, -1))
127 luaL_error(L, "no function environment for tail call at level %d",
128 level);
129 }
130}
131
132
133static int luaB_getfenv (lua_State *L) {

Callers 2

luaB_getfenvFunction · 0.85
luaB_setfenvFunction · 0.85

Calls 5

lua_pushvalueFunction · 0.70
lua_getstackFunction · 0.70
luaL_argerrorFunction · 0.70
lua_getinfoFunction · 0.70
luaL_errorFunction · 0.70

Tested by

no test coverage detected