| 1396 | |
| 1397 | |
| 1398 | LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { |
| 1399 | const char *name; |
| 1400 | TValue *val = NULL; /* to avoid warnings */ |
| 1401 | GCObject *owner = NULL; /* to avoid warnings */ |
| 1402 | TValue *fi; |
| 1403 | lua_lock(L); |
| 1404 | fi = index2value(L, funcindex); |
| 1405 | api_checknelems(L, 1); |
| 1406 | name = aux_upvalue(fi, n, &val, &owner); |
| 1407 | if (name) { |
| 1408 | L->top.p--; |
| 1409 | setobj(L, val, s2v(L->top.p)); |
| 1410 | luaC_barrier(L, owner, val); |
| 1411 | } |
| 1412 | lua_unlock(L); |
| 1413 | return name; |
| 1414 | } |
| 1415 | |
| 1416 | |
| 1417 | static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) { |
no test coverage detected