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

Function findlocal

third-party/lua-5.3.5/src/ldebug.c:145–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143
144
145static const char *findlocal (lua_State *L, CallInfo *ci, int n,
146 StkId *pos) {
147 const char *name = NULL;
148 StkId base;
149 if (isLua(ci)) {
150 if (n < 0) /* access to vararg values? */
151 return findvararg(ci, -n, pos);
152 else {
153 base = ci->u.l.base;
154 name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci));
155 }
156 }
157 else
158 base = ci->func + 1;
159 if (name == NULL) { /* no 'standard' name? */
160 StkId limit = (ci == L->ci) ? L->top : ci->next->func;
161 if (limit - base >= n && n > 0) /* is 'n' inside 'ci' stack? */
162 name = "(*temporary)"; /* generic name for any valid slot */
163 else
164 return NULL; /* no name */
165 }
166 *pos = base + (n - 1);
167 return name;
168}
169
170
171LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {

Callers 2

lua_getlocalFunction · 0.70
lua_setlocalFunction · 0.70

Calls 3

findvarargFunction · 0.70
luaF_getlocalnameFunction · 0.70
currentpcFunction · 0.70

Tested by

no test coverage detected