From ed3f9f9b3040f6a55b8c672327a4d835d1a50197 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Sat, 5 Oct 2024 11:52:18 -0700 Subject: [PATCH] reduce globals code --- src/runner/cframe.rs | 8 ++++---- src/runner/color3.rs | 8 ++++---- src/runner/vector3.rs | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/runner/cframe.rs b/src/runner/cframe.rs index 8dfcbd9..9bea84f 100644 --- a/src/runner/cframe.rs +++ b/src/runner/cframe.rs @@ -64,15 +64,15 @@ pub fn set_globals(lua:&mlua::Lua,globals:&mlua::Table<'_>)->Result<(),mlua::Err //CFrame.new cframe_table.raw_set("new", - lua.create_function(|ctx,(x,y,z):(f32,f32,f32)| - Ok(ctx.create_userdata(CFrame::point(x,y,z))) + lua.create_function(|_,(x,y,z):(f32,f32,f32)| + Ok(CFrame::point(x,y,z)) )? )?; //CFrame.Angles cframe_table.raw_set("Angles", - lua.create_function(|ctx,(x,y,z):(f32,f32,f32)| - Ok(ctx.create_userdata(CFrame::angles(x,y,z))) + lua.create_function(|_,(x,y,z):(f32,f32,f32)| + Ok(CFrame::angles(x,y,z)) )? )?; diff --git a/src/runner/color3.rs b/src/runner/color3.rs index 71899e8..fb155b8 100644 --- a/src/runner/color3.rs +++ b/src/runner/color3.rs @@ -19,13 +19,13 @@ pub fn set_globals(lua:&mlua::Lua,globals:&mlua::Table<'_>)->Result<(),mlua::Err let color3_table=lua.create_table()?; color3_table.raw_set("new", - lua.create_function(|ctx,(r,g,b):(f32,f32,f32)| - Ok(ctx.create_userdata(Color3::new(r,g,b))) + lua.create_function(|_,(r,g,b):(f32,f32,f32)| + Ok(Color3::new(r,g,b)) )? )?; color3_table.raw_set("fromRGB", - lua.create_function(|ctx,(r,g,b):(u8,u8,u8)| - Ok(ctx.create_userdata(Color3::new(r as f32/255.0,g as f32/255.0,b as f32/255.0))) + lua.create_function(|_,(r,g,b):(u8,u8,u8)| + Ok(Color3::new(r as f32/255.0,g as f32/255.0,b as f32/255.0)) )? )?; diff --git a/src/runner/vector3.rs b/src/runner/vector3.rs index e6c09cd..ef47f2f 100644 --- a/src/runner/vector3.rs +++ b/src/runner/vector3.rs @@ -12,8 +12,8 @@ pub fn set_globals(lua:&mlua::Lua,globals:&mlua::Table<'_>)->Result<(),mlua::Err //Vector3.new vector3_table.raw_set("new", - lua.create_function(|ctx,(x,y,z):(f32,f32,f32)| - Ok(ctx.create_userdata(Vector3::new(x,y,z))) + lua.create_function(|_,(x,y,z):(f32,f32,f32)| + Ok(Vector3::new(x,y,z)) )? )?;