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

Function lua_getlocal

third-party/lua-5.4.6/src/ldebug.c:223–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221
222
223LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
224 const char *name;
225 lua_lock(L);
226 if (ar == NULL) { /* information about non-active function? */
227 if (!isLfunction(s2v(L->top.p - 1))) /* not a Lua function? */
228 name = NULL;
229 else /* consider live variables at function start (parameters) */
230 name = luaF_getlocalname(clLvalue(s2v(L->top.p - 1))->p, n, 0);
231 }
232 else { /* active function; get information through 'ar' */
233 StkId pos = NULL; /* to avoid warnings */
234 name = luaG_findlocal(L, ar->i_ci, n, &pos);
235 if (name) {
236 setobjs2s(L, L->top.p, pos);
237 api_incr_top(L);
238 }
239 }
240 lua_unlock(L);
241 return name;
242}
243
244
245LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {

Callers 1

db_getlocalFunction · 0.70

Calls 2

luaF_getlocalnameFunction · 0.70
luaG_findlocalFunction · 0.70

Tested by

no test coverage detected