MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / lua_copy

Function lua_copy

3rd/lua-5.4.3/src/lapi.c:249–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247
248
249LUA_API void lua_copy (lua_State *L, int fromidx, int toidx) {
250 TValue *fr, *to;
251 lua_lock(L);
252 fr = index2value(L, fromidx);
253 to = index2value(L, toidx);
254 api_check(L, isvalid(L, to), "invalid index");
255 setobj(L, to, fr);
256 if (isupvalue(toidx)) /* function upvalue? */
257 luaC_barrier(L, clCvalue(s2v(L->ci->func)), fr);
258 /* LUA_REGISTRYINDEX does not need gc barrier
259 (collector revisits it before finishing collection) */
260 lua_unlock(L);
261}
262
263
264LUA_API void lua_pushvalue (lua_State *L, int idx) {

Callers 2

pushglobalfuncnameFunction · 0.85
ll_requireFunction · 0.85

Calls 1

index2valueFunction · 0.85

Tested by

no test coverage detected