| 152 | |
| 153 | |
| 154 | LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { |
| 155 | const char *name; |
| 156 | lua_lock(L); |
| 157 | swapextra(L); |
| 158 | if (ar == NULL) { /* information about non-active function? */ |
| 159 | if (!isLfunction(L->top - 1)) /* not a Lua function? */ |
| 160 | name = NULL; |
| 161 | else /* consider live variables at function start (parameters) */ |
| 162 | name = luaF_getlocalname(clLvalue(L->top - 1)->p, n, 0); |
| 163 | } |
| 164 | else { /* active function; get information through 'ar' */ |
| 165 | StkId pos = 0; /* to avoid warnings */ |
| 166 | name = findlocal(L, ar->i_ci, n, &pos); |
| 167 | if (name) { |
| 168 | setobj2s(L, L->top, pos); |
| 169 | api_incr_top(L); |
| 170 | } |
| 171 | } |
| 172 | swapextra(L); |
| 173 | lua_unlock(L); |
| 174 | return name; |
| 175 | } |
| 176 | |
| 177 | |
| 178 | LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { |
no test coverage detected