roblox_emulator: implement :children alias for GetChildren
This commit is contained in:
parent
dabb25b3d3
commit
19c30c8701
@ -150,7 +150,7 @@ impl mlua::UserData for Instance{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
fn add_methods<M:mlua::UserDataMethods<Self>>(methods:&mut M){
|
fn add_methods<M:mlua::UserDataMethods<Self>>(methods:&mut M){
|
||||||
methods.add_method("GetChildren",|lua,this,_:()|
|
fn get_children(lua:&mlua::Lua,this:&Instance,_:())->mlua::Result<Vec<Instance>>{
|
||||||
dom_mut(lua,|dom|{
|
dom_mut(lua,|dom|{
|
||||||
let instance=this.get(dom)?;
|
let instance=this.get(dom)?;
|
||||||
let children:Vec<_>=instance
|
let children:Vec<_>=instance
|
||||||
@ -161,7 +161,9 @@ impl mlua::UserData for Instance{
|
|||||||
.collect();
|
.collect();
|
||||||
Ok(children)
|
Ok(children)
|
||||||
})
|
})
|
||||||
);
|
}
|
||||||
|
methods.add_method("children",get_children);
|
||||||
|
methods.add_method("GetChildren",get_children);
|
||||||
fn ffc(lua:&mlua::Lua,this:&Instance,(name,search_descendants):(mlua::String,Option<bool>))->mlua::Result<Option<Instance>>{
|
fn ffc(lua:&mlua::Lua,this:&Instance,(name,search_descendants):(mlua::String,Option<bool>))->mlua::Result<Option<Instance>>{
|
||||||
let name_str=&*name.to_str()?;
|
let name_str=&*name.to_str()?;
|
||||||
dom_mut(lua,|dom|{
|
dom_mut(lua,|dom|{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user