diff --git a/src/runner/instance.rs b/src/runner/instance.rs index 3f79386..edccffd 100644 --- a/src/runner/instance.rs +++ b/src/runner/instance.rs @@ -330,6 +330,10 @@ impl mlua::UserData for Instance{ let typed_value=value.as_str().ok_or(mlua::Error::runtime("Expected boolean"))?; instance.properties.insert(index_str.to_owned(),rbx_types::Variant::String(typed_value.to_owned())); }, + rbx_reflection::DataType::Value(rbx_types::VariantType::NumberSequence)=>{ + let typed_value:super::number_sequence::NumberSequence=*value.as_userdata().ok_or(mlua::Error::runtime("Expected NumberSequence"))?.borrow()?; + instance.properties.insert(index_str.to_owned(),rbx_types::Variant::NumberSequence(typed_value.into())); + }, other=>return Err(mlua::Error::runtime(format!("Unimplemented property type: {other:?}"))), } Ok(()) diff --git a/src/runner/mod.rs b/src/runner/mod.rs index de4859f..ec90f9a 100644 --- a/src/runner/mod.rs +++ b/src/runner/mod.rs @@ -7,5 +7,6 @@ mod color3; mod cframe; mod vector3; pub mod instance; +mod number_sequence; pub use runner::{Runner,Error}; diff --git a/src/runner/number_sequence.rs b/src/runner/number_sequence.rs new file mode 100644 index 0000000..bfa25bb --- /dev/null +++ b/src/runner/number_sequence.rs @@ -0,0 +1,31 @@ +#[derive(Clone,Copy)] +pub struct NumberSequence{} +impl NumberSequence{ + pub const fn new()->Self{ + Self{} + } +} +impl Into for NumberSequence{ + fn into(self)->rbx_types::NumberSequence{ + rbx_types::NumberSequence{ + keypoints:Vec::new() + } + } +} + +pub fn set_globals(lua:&mlua::Lua,globals:&mlua::Table)->Result<(),mlua::Error>{ + let number_sequence_table=lua.create_table()?; + + number_sequence_table.raw_set("new", + lua.create_function(|_,_:mlua::MultiValue| + Ok(NumberSequence::new()) + )? + )?; + + globals.set("NumberSequence",number_sequence_table)?; + + Ok(()) +} + +impl mlua::UserData for NumberSequence{} +type_from_lua_userdata!(NumberSequence); diff --git a/src/runner/runner.rs b/src/runner/runner.rs index 48dee06..b58de5f 100644 --- a/src/runner/runner.rs +++ b/src/runner/runner.rs @@ -34,6 +34,7 @@ fn init(lua:&mlua::Lua)->mlua::Result<()>{ super::vector3::set_globals(lua,&globals)?; super::cframe::set_globals(lua,&globals)?; super::instance::set_globals(lua,&globals)?; + super::number_sequence::set_globals(lua,&globals)?; Ok(()) }