roblox_emulator: convert numbers to string in Instance.__newindex
This commit is contained in:
parent
2bf34fd04c
commit
ca88eb1cad
@ -382,8 +382,13 @@ impl mlua::UserData for Instance{
|
||||
rbx_types::Variant::Int32(typed_value)
|
||||
},
|
||||
rbx_reflection::DataType::Value(rbx_types::VariantType::String)=>{
|
||||
let typed_value=value.as_str().ok_or_else(||mlua::Error::runtime("Expected string"))?;
|
||||
rbx_types::Variant::String(typed_value.to_owned())
|
||||
let typed_value=match &value{
|
||||
mlua::Value::Integer(i)=>i.to_string(),
|
||||
mlua::Value::Number(n)=>n.to_string(),
|
||||
mlua::Value::String(s)=>s.to_str()?.to_owned(),
|
||||
_=>return Err(mlua::Error::runtime("Expected string")),
|
||||
};
|
||||
rbx_types::Variant::String(typed_value)
|
||||
},
|
||||
rbx_reflection::DataType::Value(rbx_types::VariantType::UDim2)=>{
|
||||
let typed_value:&crate::runner::udim2::UDim2=&*value.as_userdata().ok_or_else(||mlua::Error::runtime("Expected UDim2"))?.borrow()?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user