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