mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 13:00:37 +00:00
Implement equality for roblox instances
This commit is contained in:
parent
34d6e622b7
commit
69754bd830
1 changed files with 8 additions and 1 deletions
|
@ -13,7 +13,7 @@ use crate::{
|
||||||
datatypes::{
|
datatypes::{
|
||||||
conversion::{DomValueToLua, LuaToDomValue},
|
conversion::{DomValueToLua, LuaToDomValue},
|
||||||
types::EnumItem,
|
types::EnumItem,
|
||||||
userdata_impl_to_string,
|
userdata_impl_eq, userdata_impl_to_string,
|
||||||
},
|
},
|
||||||
shared::instance::{
|
shared::instance::{
|
||||||
class_exists, class_is_a, find_property_enum, find_property_type, property_is_enum,
|
class_exists, class_is_a, find_property_enum, find_property_type, property_is_enum,
|
||||||
|
@ -309,6 +309,7 @@ impl Instance {
|
||||||
impl LuaUserData for Instance {
|
impl LuaUserData for Instance {
|
||||||
fn add_methods<'lua, M: LuaUserDataMethods<'lua, Self>>(methods: &mut M) {
|
fn add_methods<'lua, M: LuaUserDataMethods<'lua, Self>>(methods: &mut M) {
|
||||||
methods.add_meta_method(LuaMetaMethod::ToString, userdata_impl_to_string);
|
methods.add_meta_method(LuaMetaMethod::ToString, userdata_impl_to_string);
|
||||||
|
methods.add_meta_method(LuaMetaMethod::Eq, userdata_impl_eq);
|
||||||
/*
|
/*
|
||||||
Getting a value does the following:
|
Getting a value does the following:
|
||||||
|
|
||||||
|
@ -485,3 +486,9 @@ impl fmt::Display for Instance {
|
||||||
write!(f, "{}", self.get_name())
|
write!(f, "{}", self.get_name())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PartialEq for Instance {
|
||||||
|
fn eq(&self, other: &Self) -> bool {
|
||||||
|
self.dom_ref == other.dom_ref
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue