MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / lua_copy

Function lua_copy

xrepo/packages/l/lua/port/lua/src/lapi.c:259–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257
258
259LUA_API void lua_copy (lua_State *L, int fromidx, int toidx) {
260 TValue *fr, *to;
261 lua_lock(L);
262 fr = index2value(L, fromidx);
263 to = index2value(L, toidx);
264 api_check(L, isvalid(L, to), "invalid index");
265 setobj(L, to, fr);
266 if (isupvalue(toidx)) /* function upvalue? */
267 luaC_barrier(L, clCvalue(s2v(L->ci->func)), fr);
268 /* LUA_REGISTRYINDEX does not need gc barrier
269 (collector revisits it before finishing collection) */
270 lua_unlock(L);
271}
272
273
274LUA_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