Skip to main content

luaur_vm/functions/
lua_xpush.rs

1//! Node: `cxx:Function:Luau.VM:VM/src/lapi.cpp:206:lua_xpush`
2//! Source: `VM/src/lapi.cpp:206-212` (hand-ported)
3
4use crate::functions::index_2_addr::index2addr;
5use crate::functions::lua_concat::lua_c_threadbarrier_lapi;
6use crate::macros::api_check::api_check;
7use crate::macros::api_incr_top::api_incr_top;
8use crate::macros::setobj_2_s::setobj2s;
9use crate::type_aliases::lua_state::lua_State;
10
11#[allow(non_snake_case)]
12pub unsafe fn lua_xpush(from: *mut lua_State, to: *mut lua_State, idx: core::ffi::c_int) {
13    api_check!(from, (*from).global == (*to).global);
14    lua_c_threadbarrier_lapi(to);
15    let o = index2addr(from, idx);
16    setobj2s!(to, (*to).top, o);
17    api_incr_top!(to);
18}