| 170 | |
| 171 | |
| 172 | LUA_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 | |
| 196 | LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { |
no test coverage detected