| 192 | |
| 193 | |
| 194 | LUA_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 | |
| 218 | LUA_API const char *lua_setlocal(lua_State *L, const lua_Debug *ar, int n) { |
no test coverage detected