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

Function lua_replace

xrepo/packages/l/luau/port/luau/VM/src/lapi.cpp:248–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248void lua_replace(lua_State* L, int idx)
249{
250 api_checknelems(L, 1);
251 luaC_threadbarrier(L);
252 StkId o = index2addr(L, idx);
253 api_checkvalidindex(L, o);
254 if (idx == LUA_ENVIRONINDEX)
255 {
256 api_check(L, L->ci != L->base_ci);
257 Closure* func = curr_func(L);
258 api_check(L, ttistable(L->top - 1));
259 func->env = hvalue(L->top - 1);
260 luaC_barrier(L, func, L->top - 1);
261 }
262 else if (idx == LUA_GLOBALSINDEX)
263 {
264 api_check(L, ttistable(L->top - 1));
265 L->gt = hvalue(L->top - 1);
266 }
267 else
268 {
269 setobj(L, o, L->top - 1);
270 if (idx < LUA_GLOBALSINDEX) // function upvalue?
271 luaC_barrier(L, curr_func(L), L->top - 1);
272 }
273 L->top--;
274}
275
276void lua_pushvalue(lua_State* L, int idx)
277{

Callers 7

gmatch_auxFunction · 0.85
luaB_xpcallyFunction · 0.85
luaB_xpcallcontFunction · 0.85
luaL_sandboxthreadFunction · 0.85
generic_readerFunction · 0.85
findfieldFunction · 0.85
io_linesFunction · 0.85

Calls 1

index2addrFunction · 0.85

Tested by

no test coverage detected