roblox_emulator: support more Vector3.new argument variants
This commit is contained in:
parent
18269423a5
commit
e673a12beb
@ -16,8 +16,12 @@ pub fn set_globals(lua:&mlua::Lua,globals:&mlua::Table)->Result<(),mlua::Error>{
|
||||
|
||||
//Vector3.new
|
||||
table.raw_set("new",
|
||||
lua.create_function(|_,(x,y,z):(Number,Number,Number)|
|
||||
Ok(Vector3::new(x.into(),y.into(),z.into()))
|
||||
lua.create_function(|_,(x,y,z):(Option<Number>,Option<Number>,Option<Number>)|
|
||||
match (x,y,z){
|
||||
(Some(x),Some(y),Some(z))=>Ok(Vector3::new(x.into(),y.into(),z.into())),
|
||||
(None,None,None)=>Ok(Vector3(glam::Vec3A::ZERO)),
|
||||
_=>Err(mlua::Error::runtime("Unsupported arguments to Vector3.new")),
|
||||
}
|
||||
)?
|
||||
)?;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user