-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vector2 and Vector3 should implement __idiv
#153
Comments
Floored division isn't a feature of luau, IIRC. EDIT: Yes, turns out this is true. As per mlua docs, the |
Considering this is fairly simple to be implemented in pure luau, I question the requirement of having to implement this on Rust-side (i.e., providing a convenience function), especially considering the fact that it wouldn't integrate into luau well. |
@CompeyDev As I understand Lune's Vector datatypes, they should support the same API surface as Roblox's Vector datatypes (https://github.com/lune-org/lune/blob/main/src/roblox/datatypes/types/vector3.rs#L19-L20). While not documented on their official docs, Roblox does support integer division for both Vector datatypes, so Lune should as well: |
We would need to implement a custom metamethod or something similar, no clue how that could be approached in mlua. Will update if there is a straightforward way to do it. |
Presumably this should be escalated to an issue in mlua? The luau spec specifies that Luau supports the __idiv metamethod. |
You're correct, I'm able to use floored division in the vanilla luau REPL, but not in lune. That's odd. |
I've created an issue: mlua-rs/mlua#383. |
Vector2
andVector3
currently do not support the//
operator in Lune, but they do in Roblox.Should allow:
Vector2 // Vector2
->Vector2
Vector2 // number
->Vector2
Vector3 // Vector3
->Vector3
Vector3 // number
->Vector3
Pseudo code in Lua:
The text was updated successfully, but these errors were encountered: