MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / lua_getlocal

Function lua_getlocal

lib/lua/src/ldebug.c:220–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

db_getlocalFunction · 0.85

Calls 2

luaF_getlocalnameFunction · 0.85
luaG_findlocalFunction · 0.85

Tested by

no test coverage detected