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

Function findlocal

third-party/lua-5.2.4/src/ldebug.c:128–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126
127
128static const char *findlocal (lua_State *L, CallInfo *ci, int n,
129 StkId *pos) {
130 const char *name = NULL;
131 StkId base;
132 if (isLua(ci)) {
133 if (n < 0) /* access to vararg values? */
134 return findvararg(ci, -n, pos);
135 else {
136 base = ci->u.l.base;
137 name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci));
138 }
139 }
140 else
141 base = ci->func + 1;
142 if (name == NULL) { /* no 'standard' name? */
143 StkId limit = (ci == L->ci) ? L->top : ci->next->func;
144 if (limit - base >= n && n > 0) /* is 'n' inside 'ci' stack? */
145 name = "(*temporary)"; /* generic name for any valid slot */
146 else
147 return NULL; /* no name */
148 }
149 *pos = base + (n - 1);
150 return name;
151}
152
153
154LUA_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