| 1388 | |
| 1389 | |
| 1390 | LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { |
| 1391 | const char *name; |
| 1392 | TValue *val = NULL; /* to avoid warnings */ |
| 1393 | GCObject *owner = NULL; /* to avoid warnings */ |
| 1394 | TValue *fi; |
| 1395 | lua_lock(L); |
| 1396 | fi = index2value(L, funcindex); |
| 1397 | api_checknelems(L, 1); |
| 1398 | name = aux_upvalue(fi, n, &val, &owner); |
| 1399 | if (name) { |
| 1400 | L->top--; |
| 1401 | setobj(L, val, s2v(L->top)); |
| 1402 | luaC_barrier(L, owner, val); |
| 1403 | } |
| 1404 | lua_unlock(L); |
| 1405 | return name; |
| 1406 | } |
| 1407 | |
| 1408 | |
| 1409 | static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) { |
no test coverage detected