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

Function luaG_findlocal

third-party/lua-5.5.0/src/ldebug.c:198–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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