| 1514 | |
| 1515 | |
| 1516 | LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { |
| 1517 | const char *name; |
| 1518 | TValue *val = NULL; /* to avoid warnings */ |
| 1519 | GCObject *owner = NULL; /* to avoid warnings */ |
| 1520 | TValue *fi; |
| 1521 | lua_lock(L); |
| 1522 | fi = index2value(L, funcindex); |
| 1523 | api_checknelems(L, 1); |
| 1524 | name = aux_upvalue(fi, n, &val, &owner); |
| 1525 | if (name) { |
| 1526 | L->top.p--; |
| 1527 | setobj(L, val, s2v(L->top.p)); |
| 1528 | luaC_barrier(L, owner, val); |
| 1529 | } |
| 1530 | lua_unlock(L); |
| 1531 | return name; |
| 1532 | } |
| 1533 | |
| 1534 | |
| 1535 | static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) { |
no test coverage detected