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

Implement Lua operator overloading for wrapped Python objects #51

Open
scoder opened this issue May 29, 2015 · 2 comments
Open

Implement Lua operator overloading for wrapped Python objects #51

scoder opened this issue May 29, 2015 · 2 comments

Comments

@scoder
Copy link
Owner

scoder commented May 29, 2015

Lua objects support operator overloading in their metatable:

http://www.lua.org/manual/5.3/manual.html#2.4

Mapping the Lua arithmetic etc. operators for wrapped Python objects to the equivalent Python operators should provide a much better user experience.

This also needs some kind of security support. Either through the normal attribute access intercept (which would have to check for special methods anyway), or through a separate set of explicitly allowed operators. Maybe both: explicitly allowed operators are fast, the rest goes through the special attribute lookup.

@noahcgreen
Copy link

Is there a way to do this at all right now?

@scoder
Copy link
Owner Author

scoder commented Jul 23, 2020

Is there a way to do this at all right now?

You can probably set up a metatable from Lua-side, so yes, it can be done, I think. Would just be substantially nicer to have it done automatically, since all the introspection capabilities are there.

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

No branches or pull requests

2 participants