GetDescendants

This commit is contained in:
Quaternions 2024-09-18 20:16:28 -07:00
parent a394778a8e
commit 261e0a474e

View File

@ -66,6 +66,17 @@ impl mlua::UserData for Instance{
Ok(children)
})
);
methods.add_method("GetDescendants",|lua,this,_:()|
dom(lua,|dom|{
let children:Vec<_>=dom
.descendants_of(this.referent)
.map(|instance|
Instance::new(instance.referent())
)
.collect();
Ok(children)
})
);
methods.add_method("IsA",|lua,this,classname:mlua::String|
dom(lua,|dom|{
let instance=this.get(dom)?;