MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / lua_getlocal

Function lua_getlocal

src/Chain/libraries/glua/ldebug.cpp:194–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192
193
194LUA_API const char *lua_getlocal(lua_State *L, const lua_Debug *ar, int n) {
195 const char *name;
196 lua_lock(L);
197 swapextra(L);
198 if (ar == nullptr) { /* information about non-active function? */
199 if (!isLfunction(L->top - 1)) /* not a Lua function? */
200 name = nullptr;
201 else /* consider live variables at function start (parameters) */
202 name = luaF_getlocalname(clLvalue(L->top - 1)->p, n, 0);
203 }
204 else { /* active function; get information through 'ar' */
205 StkId pos = nullptr; /* to avoid warnings */
206 name = findlocal(L, ar->i_ci, n, &pos);
207 if (name) {
208 setobj2s(L, L->top, pos);
209 api_incr_top(L);
210 }
211 }
212 swapextra(L);
213 lua_unlock(L);
214 return name;
215}
216
217
218LUA_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