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

Function luaG_findlocal

third-party/lua-5.4.6/src/ldebug.c:199–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197
198
199const char *luaG_findlocal (lua_State *L, CallInfo *ci, int n, StkId *pos) {
200 StkId base = ci->func.p + 1;
201 const char *name = NULL;
202 if (isLua(ci)) {
203 if (n < 0) /* access to vararg values? */
204 return findvararg(ci, n, pos);
205 else
206 name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci));
207 }
208 if (name == NULL) { /* no 'standard' name? */
209 StkId limit = (ci == L->ci) ? L->top.p : ci->next->func.p;
210 if (limit - base >= n && n > 0) { /* is 'n' inside 'ci' stack? */
211 /* generic name for any valid slot */
212 name = isLua(ci) ? "(temporary)" : "(C temporary)";
213 }
214 else
215 return NULL; /* no name */
216 }
217 if (pos)
218 *pos = base + (n - 1);
219 return name;
220}
221
222
223LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {

Callers 3

lua_getlocalFunction · 0.70
lua_setlocalFunction · 0.70
checkclosemthFunction · 0.70

Calls 3

findvarargFunction · 0.70
luaF_getlocalnameFunction · 0.70
currentpcFunction · 0.70

Tested by

no test coverage detected