| 1406 | |
| 1407 | |
| 1408 | LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { |
| 1409 | const char *name; |
| 1410 | TValue *val = NULL; /* to avoid warnings */ |
| 1411 | GCObject *owner = NULL; /* to avoid warnings */ |
| 1412 | TValue *fi; |
| 1413 | lua_lock(L); |
| 1414 | fi = index2value(L, funcindex); |
| 1415 | api_checknelems(L, 1); |
| 1416 | name = aux_upvalue(fi, n, &val, &owner); |
| 1417 | if (name) { |
| 1418 | L->top.p--; |
| 1419 | setobj(L, val, s2v(L->top.p)); |
| 1420 | luaC_barrier(L, owner, val); |
| 1421 | } |
| 1422 | lua_unlock(L); |
| 1423 | return name; |
| 1424 | } |
| 1425 | |
| 1426 | |
| 1427 | static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) { |
no test coverage detected