MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / lua_replace

Function lua_replace

Source/Misc/lua/src/lua.c:2052–2074  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2050
2051
2052LUA_API void lua_replace (lua_State *L, int idx) {
2053StkId o;
2054lua_lock(L);
2055/* explicit test for incompatible code */
2056if (idx == LUA_ENVIRONINDEX && L->ci == L->base_ci)
2057luaG_runerror(L, "no calling environment");
2058api_checknelems(L, 1);
2059o = index2adr(L, idx);
2060api_checkvalidindex(L, o);
2061if (idx == LUA_ENVIRONINDEX) {
2062Closure *func = curr_func(L);
2063api_check(L, ttistable(L->top - 1));
2064func->c.env = hvalue(L->top - 1);
2065luaC_barrier(L, func, L->top - 1);
2066}
2067else {
2068setobj(L, o, L->top - 1);
2069if (idx < LUA_GLOBALSINDEX) /* function upvalue? */
2070luaC_barrier(L, curr_func(L), L->top - 1);
2071}
2072L->top--;
2073lua_unlock(L);
2074}
2075
2076
2077LUA_API void lua_pushvalue (lua_State *L, int idx) {

Callers 12

usb.cFile · 0.85
luaopen_usbFunction · 0.85
do_call_member_selectionFunction · 0.85
set_instance_valueFunction · 0.85
postcallMethod · 0.85
generic_readerFunction · 0.85
luaB_xpcallFunction · 0.85
luaopen_ioFunction · 0.85
luaopen_packageFunction · 0.85
gmatch_auxFunction · 0.85

Calls 2

luaG_runerrorFunction · 0.85
index2adrFunction · 0.85

Tested by

no test coverage detected