MCPcopy Create free account
hub / github.com/F-Stack/f-stack / findlocal

Function findlocal

freebsd/contrib/openzfs/module/lua/ldebug.c:124–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Tested by

no test coverage detected