roblox-rs / bindings

Rust bindings for the Roblox standard library.
https://github.com/Rerumu/Wasynth
MIT License
44 stars 6 forks source link

What is wrong with enums? #17

Closed notdanilo closed 8 months ago

notdanilo commented 8 months ago

I am trying to use

part.set_material(&Material::Neon);

But it says that it is "Unable to assign property Material. Invalid value 1049436 for enum Material" where 1049436 is a constant value through different executions.

The roblox_enum defines Neon = 288.

Fireboltofdeath commented 8 months ago

It would appear the generated Rust typings aren't correct, there shouldn't be a borrow there, so the Luau code is receiving a pointer and not the enum. https://github.com/roblox-rs/bindings/blob/master/build/codegen/rust/conversion.rs

Likewise, we probably want to make all of the Roblox enums Copy so that we don't have issues with ownership

notdanilo commented 8 months ago

I will try to investigate it