forked from StrafesNET/strafe-client
Luau: Vector3(x,y,z)
This commit is contained in:
parent
bf0ed47ceb
commit
41b9aafd54
24
src/luau.rs
24
src/luau.rs
@ -1,4 +1,4 @@
|
|||||||
use mlua::{Lua as Luau, Result, Table};
|
use mlua::{Lua as Luau, Result, Table, Function};
|
||||||
use glam::Vec3;
|
use glam::Vec3;
|
||||||
|
|
||||||
struct StrafeluaGlobals<'a> {
|
struct StrafeluaGlobals<'a> {
|
||||||
@ -13,19 +13,15 @@ impl<'a> StrafeluaGlobals<'a> {
|
|||||||
let main_table = &self.current_vm.create_table().unwrap();
|
let main_table = &self.current_vm.create_table().unwrap();
|
||||||
main_table.clone()
|
main_table.clone()
|
||||||
}
|
}
|
||||||
fn vector3(&self) -> Table<'a> {
|
fn vector3(&self) -> Function {
|
||||||
let vec3 = &self.current_vm.create_table().unwrap();
|
return self.current_vm.create_function(|vm, (x,y,z): (f32,f32,f32)| {
|
||||||
|
let glam_vec = Vec3::new(x,y,z);
|
||||||
|
let vec3 = vm.create_table().unwrap();
|
||||||
// self.current_vm.create_function(|vm, (x,y,z): (f32,f32,f32)| {
|
vec3.set("x", glam_vec.x).unwrap();
|
||||||
// let vec = Vec3::new(x,y,z);
|
vec3.set("y", glam_vec.y).unwrap();
|
||||||
// vec3.set("x", vec.x).unwrap();
|
vec3.set("z", glam_vec.z).unwrap();
|
||||||
// vec3.set("y", vec.y).unwrap();
|
Ok(vec3)
|
||||||
// vec3.set("z", vec.z).unwrap();
|
}).unwrap();
|
||||||
// Ok(vec3)
|
|
||||||
// }).unwrap();
|
|
||||||
|
|
||||||
return vec3.clone()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user