Implement Push for Ref

This commit is contained in:
lumi 2025-06-23 11:43:47 +10:00
parent 173149f2f7
commit c39106b790
Signed by: luaneko
GPG Key ID: 406809B8763FF07A

View File

@ -1613,6 +1613,13 @@ impl_push_str!(BString);
impl_push_str!(&str);
impl_push_str!(String);
impl Push for Ref {
fn push(&self, stack: &mut Stack) {
stack.ensure(1);
unsafe { lua_rawgeti(stack.as_ptr(), LUA_REGISTRYINDEX, self.key) }
}
}
/// [`Push`]es a copy of the value at an index onto a [`Stack`].
///
/// Equivalent to [`lua_pushvalue`].