use luau_vm::Thread as VmThread;
use crate::error::Error;
pub(crate) trait LuaType {
fn push_type_key(thread: impl AsRef<VmThread>) -> Result<(), Error>;
}
impl LuaType for bool {
fn push_type_key(thread: impl AsRef<VmThread>) -> Result<(), Error> {
let thread = thread.as_ref();
unsafe {
thread
.push_boolean(0)
.map_err(|exit| Error::from_thread_exit(thread, exit))
}
}
}
impl LuaType for f64 {
fn push_type_key(thread: impl AsRef<VmThread>) -> Result<(), Error> {
let thread = thread.as_ref();
unsafe {
thread
.push_number(0.0)
.map_err(|exit| Error::from_thread_exit(thread, exit))
}
}
}
impl LuaType for i64 {
fn push_type_key(thread: impl AsRef<VmThread>) -> Result<(), Error> {
let thread = thread.as_ref();
unsafe {
thread
.push_integer64(0)
.map_err(|exit| Error::from_thread_exit(thread, exit))
}
}
}