Temporary return solution

fighting the borrow checker
This commit is contained in:
unittensor 2024-01-20 23:03:37 -05:00
parent fdf0205c98
commit bf0ed47ceb

View File

@ -29,7 +29,7 @@ impl<'a> StrafeluaGlobals<'a> {
} }
} }
pub fn new_state() -> Result<Luau> { pub fn new_state() -> Result<()> {
let vm = Luau::new(); let vm = Luau::new();
vm.sandbox(true).unwrap(); vm.sandbox(true).unwrap();
//Prevent bad actors //Prevent bad actors
@ -44,7 +44,6 @@ pub fn new_state() -> Result<Luau> {
vm.globals().set("Player", strafe_player).unwrap(); vm.globals().set("Player", strafe_player).unwrap();
vm.globals().set("Vector3", strafe_vector3).unwrap(); vm.globals().set("Vector3", strafe_vector3).unwrap();
let gib = *strafe_globals.current_vm;
let _ = vm.load(r#" let _ = vm.load(r#"
type f64 = number type f64 = number
type vec3 = (x: f64, y: f64, z: f64) -> {x: f64, y: f64, z: f64} type vec3 = (x: f64, y: f64, z: f64) -> {x: f64, y: f64, z: f64}
@ -54,5 +53,5 @@ local v3 = Vector3(-10, 30, 50)
print((`{("\n"):rep(3)} x=%d,y=%d,z=%d {("\n"):rep(3)}`):format(v3.x, v3.y, v3.z)) print((`{("\n"):rep(3)} x=%d,y=%d,z=%d {("\n"):rep(3)}`):format(v3.x, v3.y, v3.z))
"#).exec(); "#).exec();
Ok(gib) Ok(())
} }