Skip to content
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

add custom operator support for number and integer #1296

Closed
wants to merge 1 commit into from

Conversation

thoys
Copy link

@thoys thoys commented Jul 7, 2022

This PR adds support for extending the number / integer operators.

For example if you have a Vector3 class that could be multiplied with now this will work

---@class integer
---@operator mul(Vector3): Vector3
---@class number
---@operator mul(Vector3): Vector3
local shouldShowupAsAVector3 = 1.0 * Vector3.New(1,2,3);

@sumneko
Copy link
Collaborator

sumneko commented Jul 7, 2022

First of all, thank you for your PR.
But I don't think this can work, the operator should be a part of Vector3 instead of integer or number, but the current design does not support it as the second operation.
In addition, you need to add unit testing

@sumneko
Copy link
Collaborator

sumneko commented Jul 26, 2022

see #1371

@sumneko sumneko closed this Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants