roblox_emulator: support more Vector3.new argument variants

This commit is contained in:
Quaternions 2025-04-23 13:32:16 -07:00
parent 18269423a5
commit e673a12beb
Signed by: Quaternions
GPG Key ID: D0DF5964F79AC131

@ -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")),
}
)?
)?;