luaur_vm/macros/getnodekey.rs
1//! Node: `cxx:Macro:Luau.VM:VM/src/lobject.h:494:getnodekey`
2//! Source: `VM/src/lobject.h:494-501` (hand-checked)
3//!
4//! C++ copies `n_->key.tt` — the 4-bit `tt` BITFIELD only, not the packed
5//! `tt|next` word (the original translation wrote `key.tt_next` into `tt`,
6//! smearing the next-pointer bits into the type tag). The Rust `TKey` packs
7//! the bitfields as `tt_next` with a `tt()` accessor.
8
9#[allow(non_snake_case)]
10#[macro_export]
11macro_rules! getnodekey {
12 ($L:expr, $obj:expr, $node:expr) => {
13 unsafe {
14 let i_o: *mut $crate::type_aliases::t_value::TValue = $obj;
15 let n_: *const $crate::records::lua_node::LuaNode = $node;
16 (*i_o).value = (*n_).key.value;
17 core::ptr::copy_nonoverlapping(
18 (*n_).key.extra.as_ptr(),
19 (*i_o).extra.as_mut_ptr(),
20 (*i_o).extra.len(),
21 );
22 (*i_o).tt = (*n_).key.tt();
23 $crate::macros::checkliveness::checkliveness!((*$L).global, i_o);
24 }
25 };
26}
27
28pub use getnodekey;