MCPcopy Create free account
hub / github.com/DFHack/dfhack / lua_getlocal

Function lua_getlocal

depends/lua/src/ldebug.c:172–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170
171
172LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
173 const char *name;
174 lua_lock(L);
175 swapextra(L);
176 if (ar == NULL) { /* information about non-active function? */
177 if (!isLfunction(L->top - 1)) /* not a Lua function? */
178 name = NULL;
179 else /* consider live variables at function start (parameters) */
180 name = luaF_getlocalname(clLvalue(L->top - 1)->p, n, 0);
181 }
182 else { /* active function; get information through 'ar' */
183 StkId pos = NULL; /* to avoid warnings */
184 name = findlocal(L, ar->i_ci, n, &pos);
185 if (name) {
186 setobj2s(L, L->top, pos);
187 api_incr_top(L);
188 }
189 }
190 swapextra(L);
191 lua_unlock(L);
192 return name;
193}
194
195
196LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {

Callers 1

db_getlocalFunction · 0.85

Calls 3

swapextraFunction · 0.85
luaF_getlocalnameFunction · 0.85
findlocalFunction · 0.85

Tested by

no test coverage detected