Prevent setting Parent prop of DataModel instances

This commit is contained in:
Filip Tibell 2023-03-22 10:15:39 +01:00
parent 178f7b41ab
commit a21861918b
No known key found for this signature in database

View file

@ -732,6 +732,11 @@ impl LuaUserData for Instance {
"Failed to set property '{}' - root instance can not be reparented", "Failed to set property '{}' - root instance can not be reparented",
prop_name prop_name
))); )));
} else if this.get_class_name() == "DataModel" {
return Err(LuaError::RuntimeError(format!(
"Failed to set property '{}' - DataModel can not be reparented",
prop_name
)));
} }
type Parent = Option<Instance>; type Parent = Option<Instance>;
match Parent::from_lua(prop_value, lua)? { match Parent::from_lua(prop_value, lua)? {