luaur_vm/functions/
lua_a_toobject.rs1use core::ffi::c_int;
2
3use crate::functions::index_2_addr::index_2_addr;
4pub use crate::macros::lua_o_nilobject::luaO_nilobject;
5use crate::type_aliases::lua_state::lua_State;
6use crate::type_aliases::stk_id::StkId;
7use crate::type_aliases::t_value::TValue;
8
9#[allow(non_snake_case)]
10pub unsafe fn luaA_toobject(L: *mut lua_State, idx: c_int) -> *const TValue {
11 let p: StkId = index_2_addr(L, idx);
12
13 if p == luaO_nilobject as StkId {
14 core::ptr::null()
15 } else {
16 p as *const TValue
17 }
18}