luaur_vm/functions/
lua_rawgetptagged.rs1use core::ffi::{c_int, c_void};
2
3use crate::functions::index_2_addr::index2addr;
4use crate::functions::lua_concat::lua_c_threadbarrier_lapi;
5use crate::functions::lua_h_getp::lua_h_getp;
6use crate::macros::api_check::api_check;
7use crate::macros::api_incr_top::api_incr_top;
8use crate::macros::hvalue::hvalue;
9use crate::macros::setobj_2_s::setobj2s;
10use crate::macros::ttistable::ttistable;
11use crate::macros::ttype::ttype;
12use crate::records::lua_state::lua_State;
13use crate::type_aliases::stk_id::StkId;
14
15#[allow(non_snake_case)]
16pub unsafe fn lua_rawgetptagged(
17 L: *mut lua_State,
18 idx: c_int,
19 p: *mut c_void,
20 tag: c_int,
21) -> c_int {
22 lua_c_threadbarrier_lapi(L);
23
24 let t: StkId = index2addr(L, idx);
25 api_check!(L, ttistable!(t));
26
27 setobj2s!(L, (*L).top, lua_h_getp(hvalue!(t), p, tag));
28 api_incr_top!(L);
29
30 ttype!((*L).top.sub(1))
31}