luaur_vm/macros/vvalue.rs
1use crate::macros::check_exp::check_exp;
2use crate::macros::ttisvector::ttisvector;
3
4#[allow(non_snake_case)]
5#[macro_export]
6macro_rules! vvalue {
7 ($o:expr) => {
8 $crate::macros::check_exp::check_exp!(
9 $crate::macros::ttisvector::ttisvector!($o),
10 // C's `(o)->value.v` is a float* into value.v that consumers read up to
11 // [2]/[3] via the contiguous value+extra layout. Return a reference over
12 // the whole component run (NOT a by-value [f32;2] copy, whose temporary
13 // would make .as_ptr().offset(2) read freed stack — the z-garbage bug).
14 &*(($o) as *const $crate::type_aliases::t_value::TValue
15 as *const [f32; $crate::macros::lua_vector_size::LUA_VECTOR_SIZE as usize])
16 )
17 };
18}
19
20pub use vvalue;